diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-04-21 20:35:43 +0200 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-04-21 20:35:43 +0200 |
commit | e3b3bdf86e9e9921ce6c76e8dd587dbe0b41f33e (patch) | |
tree | 6f9ae0c3b56199b05c477baa82bb5218df3b5ba4 /src/livestreamer/plugins/ustreamtv.py | |
parent | 0eb8969b0667fb641356a5734126b645aa211c0f (diff) |
Make get_streams always return a dict.
Diffstat (limited to 'src/livestreamer/plugins/ustreamtv.py')
-rw-r--r-- | src/livestreamer/plugins/ustreamtv.py | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/src/livestreamer/plugins/ustreamtv.py b/src/livestreamer/plugins/ustreamtv.py index 54ea021..63a3134 100644 --- a/src/livestreamer/plugins/ustreamtv.py +++ b/src/livestreamer/plugins/ustreamtv.py @@ -30,29 +30,27 @@ class UStreamTV(Plugin): if match: return str(match.group(1), "ascii") + streams = {} channelid = self._get_channel_id(self.url) - if not channelid: - return False - - fd = urllib.urlopen(self.AMFURL.format(channelid)) - data = fd.read() - fd.close() - - playpath = get_amf_value(data, "streamName") - cdnurl = get_amf_value(data, "cdnUrl") - fmsurl = get_amf_value(data, "fmsUrl") - - if not playpath: - return False - - stream = RTMPStream({ - "rtmp": ("{0}/{1}").format(cdnurl or fmsurl, playpath), - "pageUrl": self.url, - "swfUrl": self.SWFURL, - "live": 1 - }) - - return {"live": stream} + if channelid: + fd = urllib.urlopen(self.AMFURL.format(channelid)) + data = fd.read() + fd.close() + + playpath = get_amf_value(data, "streamName") + cdnurl = get_amf_value(data, "cdnUrl") + fmsurl = get_amf_value(data, "fmsUrl") + + if playpath: + stream = RTMPStream({ + "rtmp": ("{0}/{1}").format(cdnurl or fmsurl, playpath), + "pageUrl": self.url, + "swfUrl": self.SWFURL, + "live": 1 + }) + streams["live"] = stream + + return streams register_plugin("ustreamtv", UStreamTV) |