Exemplo n.º 1
0
    def __init__(self):
        self.camera = pls.Microphone('stream.ini',
                                     'youtube',
                                     image='live.png',
                                     yes=True)

        self.camera.golive()
Exemplo n.º 2
0
def main():
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    p = ArgumentParser(description="livestream microphone audio")
    p.add_argument(
        'websites',
        help='site to stream, e.g. localhost youtube periscope facebook twitch',
        nargs='+')
    p.add_argument('-image', help='static image to display.')
    p.add_argument('-i', '--ini', help='*.ini file with stream parameters')
    p.add_argument('-y',
                   '--yes',
                   help='no confirmation dialog',
                   action='store_true')
    p.add_argument('-t',
                   '--timeout',
                   help='stop streaming after --timeout seconds',
                   type=int)
    P = p.parse_args()

    s = pls.Microphone(P.ini,
                       P.websites,
                       image=P.image,
                       yes=P.yes,
                       timeout=P.timeout)
    sites = list(s.streams.keys())
    # %% Go live
    if P.yes:
        print('going live on', sites)
    else:
        input(f"Press Enter to go live on {sites}.    Or Ctrl C to abort.")

    s.golive()
Exemplo n.º 3
0
def main():
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    p = ArgumentParser(description="livestream microphone audio")
    p.add_argument('site',
                   help='site to stream: [youtube,periscope,facebook,twitch]',
                   nargs='?',
                   default='localhost')
    p.add_argument('-image',
                   help='static image to display.',
                   default=R / 'doc/logo.png')
    p.add_argument('-i',
                   '--ini',
                   help='*.ini file with stream parameters',
                   default=R / 'stream.ini')
    p.add_argument('-y',
                   '--yes',
                   help='no confirmation dialog',
                   action='store_true')
    P = p.parse_args()

    site = P.site.split()

    s = pls.Microphone(P.ini, site, image=P.image, yes=P.yes)
    sites = list(s.streams.keys())
    # %% Go live
    if P.yes:
        print('going live on', sites)
    else:
        input(f"Press Enter to go live on {sites}.    Or Ctrl C to abort.")

    s.golive()
Exemplo n.º 4
0
def test_microphone_stream(listener):
    global skip
    S = pls.Microphone(inifn, 'localhost-test', image=LOGO)

    ok = S.check_device()

    if not ok:
        skip = True
        pytest.skip(f'device not available: {S.streams.popitem()[1].checkcmd}')

    S.golive()
def test_props(periscope_kbps):
    S = pls.Microphone(inifn=None, websites=sites, image=LOGO, key='abc')

    for s in S.streams:
        assert '-re' not in S.streams[s].cmd
        assert S.streams[s].fps is None
        assert S.streams[s].res == [720, 540]

        if s == 'periscope':
            assert S.streams[s].video_kbps == periscope_kbps
        else:
            assert S.streams[s].video_kbps == 800
def test_microphone_4Kbg():
    S = pls.Microphone(inifn, sites, image=IMG4K)

    for s in S.streams:
        assert '-re' not in S.streams[s].cmd
        assert S.streams[s].fps is None
        assert S.streams[s].res == (3840, 2160)

        if s == 'periscope':
            assert S.streams[s].video_kbps == 800
        else:
            assert S.streams[s].video_kbps == 4000
def test_microphone():
    S = pls.Microphone(inifn, sites, image=LOGO)

    for s in S.streams:
        assert '-re' not in S.streams[s].cmd
        assert S.streams[s].fps is None
        assert S.streams[s].res == (720, 540)

        if s == 'periscope':
            assert S.streams[s].video_kbps == 800
        else:
            assert S.streams[s].video_kbps == 800
Exemplo n.º 8
0
def test_microphone_image(periscope_kbps):

    with importlib.resources.path("pylivestream.data", "check4k.png") as img:
        S = pls.Microphone(inifn=None, websites=sites, image=img, key="abc")

        for s in S.streams:
            assert "-re" not in S.streams[s].cmd
            assert S.streams[s].fps is None
            assert S.streams[s].res == [3840, 2160]

            if s == "periscope":
                assert S.streams[s].video_kbps == periscope_kbps
            else:
                assert S.streams[s].video_kbps == 4000
Exemplo n.º 9
0
def test_microphone_props(periscope_kbps):

    with importlib.resources.path("pylivestream.data", "logo.png") as logo:
        S = pls.Microphone(inifn=None, websites=sites, image=logo, key="abc")

        for s in S.streams:
            assert "-re" not in S.streams[s].cmd
            assert S.streams[s].fps is None
            assert S.streams[s].res == [720, 540]

            if s == "periscope":
                assert S.streams[s].video_kbps == periscope_kbps
            else:
                assert S.streams[s].video_kbps == 800
def test_microphone_stream():
    S = pls.Microphone(inifn, 'localhost-test', image=LOGO)

    S.golive()