aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/livestreamer/plugins/ustreamtv.py
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-03-21 13:10:02 +0100
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-03-21 13:10:02 +0100
commitf175241692dfc461d773589653fd55c47508a293 (patch)
tree38e9bb2416c5631ea08038d607d46384d2c67758 /src/livestreamer/plugins/ustreamtv.py
parent4ea8ddfd4d89ca96e81ddf07ec3c7d0abfc8de70 (diff)
Change the way plugins are used.
Also use http as default protocol when URL is missing protocol.
Diffstat (limited to 'src/livestreamer/plugins/ustreamtv.py')
-rw-r--r--src/livestreamer/plugins/ustreamtv.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/livestreamer/plugins/ustreamtv.py b/src/livestreamer/plugins/ustreamtv.py
index 90b4b8b..f191589 100644
--- a/src/livestreamer/plugins/ustreamtv.py
+++ b/src/livestreamer/plugins/ustreamtv.py
@@ -11,10 +11,11 @@ class UStreamTV(Plugin):
AMFURL = "http://cgw.ustream.tv/Viewer/getStream/1/{0}.amf"
SWFURL = "http://cdn1.ustream.tv/swf/4/viewer.rsl.210.swf"
+ @classmethod
def can_handle_url(self, url):
return "ustream.tv" in url
- def get_channel_id(self, url):
+ def _get_channel_id(self, url):
fd = urllib.urlopen(url)
data = fd.read()
fd.close()
@@ -23,14 +24,14 @@ class UStreamTV(Plugin):
if match:
return int(match.group(1))
- def get_streams(self, url):
+ def get_streams(self):
def get_amf_value(data, key):
pattern = ("{0}\W\W\W(.+?)\x00").format(key)
match = re.search(bytes(pattern, "ascii"), data)
if match:
return str(match.group(1), "ascii")
- channelid = self.get_channel_id(url)
+ channelid = self._get_channel_id(self.url)
if not channelid:
return False
@@ -50,7 +51,7 @@ class UStreamTV(Plugin):
stream["playpath"] = playpath
stream["rtmp"] = cdnurl or fmsurl
- stream["url"] = url
+ stream["url"] = self.url
return {"live": stream}