Skip to content

Instantly share code, notes, and snippets.

@MOZGIII
Last active August 29, 2015 14:27
Show Gist options
  • Save MOZGIII/8b2c3e4679c56fdade38 to your computer and use it in GitHub Desktop.
Save MOZGIII/8b2c3e4679c56fdade38 to your computer and use it in GitHub Desktop.
A tiny wrapper for livestreamer to watch twitch streams
#!/usr/bin/env python3
import sys
import os
if len(sys.argv) < 2:
print("Usage: %s [stream_name | http://stream_url]" % sys.argv[0])
sys.exit(2)
stream_url = sys.argv[1]
if not stream_url.startswith('http://') and not stream_url.startswith('https://'):
stream_url = 'http://twitch.tv/%s' % stream_url
print('Running stream: %s' % stream_url)
app = 'livestreamer'
os.execvp(app, [app, stream_url, 'best'] + sys.argv[2:])
@MOZGIII
Copy link
Author

MOZGIII commented Aug 10, 2015

Usage:

$ twitch amazhs
Running stream: http://twitch.tv/amazhs
[cli][info] Found matching plugin twitch for URL http://twitch.tv/amazhs
[cli][info] Available streams: audio, high, low, medium, mobile (worst), source (best)
[cli][info] Opening stream: source (hls)
[cli][info] Starting player: mpv -cache 8192

@MOZGIII
Copy link
Author

MOZGIII commented Aug 10, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment