2012-01-19 23:29:28 +01:00
|
|
|
Livestreamer
|
|
|
|
============
|
2012-05-27 20:12:40 +02:00
|
|
|
Livestreamer is a CLI program that launches streams from various
|
|
|
|
streaming services in a custom video player.
|
2012-01-19 23:29:28 +01:00
|
|
|
|
2012-06-18 19:36:40 +02:00
|
|
|
Currently supported sites are:
|
|
|
|
|
|
|
|
* Justin.tv/Twitch.tv
|
|
|
|
* Own3d.tv
|
|
|
|
* SVTPlay
|
|
|
|
* UStream
|
|
|
|
* YouTube
|
|
|
|
|
|
|
|
Note: Justin.tv plugin requires rtmpdump with jtv token support (recent git).
|
2012-01-19 23:29:28 +01:00
|
|
|
|
2012-05-27 20:12:40 +02:00
|
|
|
Livestreamer is compatible with Python version >= 2.6 and >= 3.0.
|
2012-01-19 23:29:28 +01:00
|
|
|
|
|
|
|
|
2012-06-18 19:36:40 +02:00
|
|
|
Installing (Linux, OS X etc)
|
|
|
|
----------
|
|
|
|
Make sure you have Python and Python setuptools then run:
|
|
|
|
|
|
|
|
$ sudo python setup.py install
|
2012-01-19 23:29:28 +01:00
|
|
|
|
|
|
|
|
2012-06-18 19:36:40 +02:00
|
|
|
Installing (Windows)
|
|
|
|
--------------------
|
|
|
|
1. Install Python
|
|
|
|
2. Install Python setuptools
|
|
|
|
3. Get rtmpdump and unpack it somewhere (rtmpdump-20110925-git-6230845-win32.zip from http://rtmpdump.mplayerhq.hu/ should work)
|
|
|
|
4. Add these paths to your Path environment variable:
|
|
|
|
* [Python path]\
|
|
|
|
* [Python path]\scripts\
|
|
|
|
* [rtmpdump path]\ (or specify full path with --rtmpdump option)
|
|
|
|
* [VLC/mplayer/other path]\ (or specify full path with --player option)
|
2012-01-19 23:29:28 +01:00
|
|
|
|
2012-06-18 19:36:40 +02:00
|
|
|
5. Open a command prompt and change directory to livestreamer source, then run:
|
2012-06-18 19:38:05 +02:00
|
|
|
|
2012-06-18 19:36:40 +02:00
|
|
|
python setup.py install
|
2012-01-19 23:29:28 +01:00
|
|
|
|
2012-08-15 22:26:39 +02:00
|
|
|
Note: If you want to use VLC be aware there is currently a bug in version 2.0.1/2.0.2
|
|
|
|
that prevents stdin reading from working. The bug has been fixed in version 2.0.3.
|
2012-01-19 23:29:28 +01:00
|
|
|
|
|
|
|
|
2012-06-18 19:36:40 +02:00
|
|
|
Using
|
|
|
|
-----
|
|
|
|
$ livestreamer --help
|
2012-01-19 23:29:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
Saving arguments AKA config file
|
|
|
|
--------------------------------
|
2012-08-23 23:37:37 +02:00
|
|
|
Livestreamer can read arguments from the file ~/.livestreamerrc (POSIX) or %APPDATA%\livestreamer\livestreamerrc (Windows).
|
2012-01-19 23:29:28 +01:00
|
|
|
A example file:
|
|
|
|
|
|
|
|
player=mplayer
|
|
|
|
jtv-cookie=_jtv3_session_id=arandomhash
|
|
|
|
|
|
|
|
|
2012-03-21 22:49:15 +01:00
|
|
|
Using livestreamer as a library
|
|
|
|
-------------------------------
|
|
|
|
Livestreamer is also a library. Short example:
|
|
|
|
|
2012-08-23 22:46:06 +02:00
|
|
|
from livestreamer import *
|
2012-03-21 22:49:15 +01:00
|
|
|
|
|
|
|
url = "http://twitch.tv/day9tv"
|
2012-08-23 22:46:06 +02:00
|
|
|
livestreamer = Livestreamer()
|
2012-03-21 22:49:15 +01:00
|
|
|
channel = livestreamer.resolve_url(url)
|
|
|
|
streams = channel.get_streams()
|
|
|
|
|
|
|
|
stream = streams["720p"]
|
2012-05-25 17:26:11 +02:00
|
|
|
fd = stream.open()
|
2012-03-21 22:49:15 +01:00
|
|
|
|
|
|
|
while True:
|
2012-05-25 17:26:11 +02:00
|
|
|
data = fd.read(1024)
|
2012-03-21 22:49:15 +01:00
|
|
|
if len(data) == 0:
|
|
|
|
break
|
|
|
|
|
|
|
|
# do something with data
|
|
|
|
|
2012-05-25 17:26:11 +02:00
|
|
|
fd.close()
|
2012-03-21 22:49:15 +01:00
|
|
|
|