josepowera / new_reader

Everything is a file. Read files, multicast, udp, http(s), and stdin with just one function.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

new_reader

read multicast, udp and http(s) like files.
    stdin:              cat video.ts | gumd
    files:              "/home/you/video.ts"
    http(s) urls:       "https://example.com/vid.ts"
    udp urls:           "udp://1.2.3.4:5555"
    multicast urls:     "udp://@227.1.3.10:4310"

UDP and Multicast

  • for UDP and Multicast, reader will set socket.SO_RCVBUF to twice the maximum value set in the OS.
    • On OpenBSD
    sysctl net.inet.udp.recvspace
    • On Linux
    sysctl net.core.rmem_max
    • On Windows
     I have no idea.

Examples

  • Files
    from new_reader import reader

    with reader("/home/you/video.ts") as data:
        fu = data.read()
  • HTTP(S)
    from new_reader import reader

    with reader("https://futzu.com/xaa.ts") as data:
        fu = data.read()
  • Multicast
    from new_reader import reader

    with reader("udp://@227.1.3.10:4310") as data:
        data.read(8192)
  • UDP
    from new_reader import reader

    udp_data =reader("udp://1.2.3.4:5555")
    chunks = [udp_data.read(188) for i in range(0,1024)]
    udp_data.close()

About

Everything is a file. Read files, multicast, udp, http(s), and stdin with just one function.


Languages

Language:Python 92.0%Language:Makefile 8.0%