diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-03-21 16:24:45 +0100 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-03-21 16:24:45 +0100 |
commit | 0f3765749001279fe232914bfa852650c4fd1162 (patch) | |
tree | 4236330f90d37783ddb76418a106b70d3912d6c1 /src/livestreamer/plugins/ustreamtv.py | |
parent | f175241692dfc461d773589653fd55c47508a293 (diff) |
Refactor the stream/command line handling.
Diffstat (limited to 'src/livestreamer/plugins/ustreamtv.py')
-rw-r--r-- | src/livestreamer/plugins/ustreamtv.py | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/livestreamer/plugins/ustreamtv.py b/src/livestreamer/plugins/ustreamtv.py index f191589..5f120f5 100644 --- a/src/livestreamer/plugins/ustreamtv.py +++ b/src/livestreamer/plugins/ustreamtv.py @@ -1,12 +1,11 @@ #!/usr/bin/env python3 from livestreamer.plugins import Plugin, register_plugin -from livestreamer.utils import CommandLine +from livestreamer.stream import RTMPStream from livestreamer.compat import urllib, str, bytes import xml.dom.minidom, re - class UStreamTV(Plugin): AMFURL = "http://cgw.ustream.tv/Viewer/getStream/1/{0}.amf" SWFURL = "http://cdn1.ustream.tv/swf/4/viewer.rsl.210.swf" @@ -40,8 +39,6 @@ class UStreamTV(Plugin): data = fd.read() fd.close() - stream = {} - playpath = get_amf_value(data, "streamName") cdnurl = get_amf_value(data, "cdnUrl") fmsurl = get_amf_value(data, "fmsUrl") @@ -49,22 +46,13 @@ class UStreamTV(Plugin): if not playpath: return False - stream["playpath"] = playpath - stream["rtmp"] = cdnurl or fmsurl - stream["url"] = self.url + stream = RTMPStream({ + "rtmp": ("{0}/{1}").format(cdnurl or fmsurl, playpath), + "pageUrl": self.url, + "swfUrl": self.SWFURL, + "live": 1 + }) return {"live": stream} - - def stream_cmdline(self, stream, filename): - cmd = CommandLine("rtmpdump") - cmd.arg("rtmp", ("{0}/{1}").format(stream["rtmp"], stream["playpath"])) - cmd.arg("swfUrl", self.SWFURL) - cmd.arg("pageUrl", stream["url"]) - cmd.arg("live", True) - cmd.arg("flv", filename) - - return cmd.format() - - register_plugin("ustreamtv", UStreamTV) |