From edfc2de50a4a15fc883a57dffed1e1ae60e93fc9 Mon Sep 17 00:00:00 2001 From: Christopher Rosell Date: Wed, 21 Mar 2012 22:49:15 +0100 Subject: Make livestreamer more usable as a library. --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 7a282eb..a04b0aa 100644 --- a/README.md +++ b/README.md @@ -47,3 +47,26 @@ Currently supported sites are: Justin.tv plugin requires rtmpdump with jtv token support (recent git). + +Using livestreamer as a library +------------------------------- +Livestreamer is also a library. Short example: + + import livestreamer + + url = "http://twitch.tv/day9tv" + channel = livestreamer.resolve_url(url) + streams = channel.get_streams() + + stream = streams["720p"] + stream.open() + + while True: + data = stream.read(1024) + if len(data) == 0: + break + + # do something with data + + stream.close() + -- cgit v1.2.3