Exemple #1
0
def main():
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    p = ArgumentParser(description="livestream webcam")
    p.add_argument(
        'websites',
        help='site to stream, e.g. localhost youtube periscope facebook twitch',
        nargs='+')
    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.Webcam(P.ini, P.websites, yes=P.yes, timeout=P.timeout)
    sites: List[str] = 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()
def test_webcam_stream(listener):
    global skip
    S = pls.Webcam(inifn, 'localhost-test')

    ok = S.check_device()

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

    S.golive()
Exemple #3
0
def test_props():
    S = pls.Webcam(inifn=None, websites=sites, key='abc')
    for s in S.streams:
        assert '-re' not in S.streams[s].cmd
        assert S.streams[s].fps == approx(30.)

        if s == 'periscope':
            assert S.streams[s].video_kbps == 800
        else:
            if int(S.streams[s].res[1]) == 480:
                assert S.streams[s].video_kbps == 500
            elif int(S.streams[s].res[1]) == 720:
                assert S.streams[s].video_kbps == 1800
def test_webcam():
    S = pls.Webcam(inifn, sites)
    for s in S.streams:
        assert '-re' not in S.streams[s].cmd
        assert S.streams[s].fps == approx(30.)

        if s == 'periscope':
            assert S.streams[s].video_kbps == 800
        else:
            if int(S.streams[s].res[1]) == 480:
                assert S.streams[s].video_kbps == 500
            elif int(S.streams[s].res[1]) == 720:
                assert S.streams[s].video_kbps == 1800
Exemple #5
0
def test_props(periscope_kbps):
    S = pls.Webcam(inifn=None, websites=sites, key="abc")
    for s in S.streams:
        assert "-re" not in S.streams[s].cmd
        assert S.streams[s].fps == approx(30.0)

        if s == "periscope":
            assert S.streams[s].video_kbps == periscope_kbps
        else:
            if int(S.streams[s].res[1]) == 480:
                assert S.streams[s].video_kbps == 500
            elif int(S.streams[s].res[1]) == 720:
                assert S.streams[s].video_kbps == 1800
def main():
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    p = ArgumentParser(description="livestream webcam")
    p.add_argument('site', help='site to stream: [youtube,periscope,facebook,twitch]',
                   nargs='?', default='localhost')
    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.Webcam(P.ini, site, yes=P.yes)
    sites: List[str] = 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()
Exemple #7
0
def test_stream():
    S = pls.Webcam(inifn=None, websites='localhost', timeout=5, key='abc')

    S.golive()
def test_webcam_stream():
    S = pls.Webcam(inifn, 'localhost-test')

    S.golive()
Exemple #9
0
def test_stream():
    S = pls.Webcam(inifn=None, websites="localhost", timeout=5, key="abc")

    S.golive()