aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-08-17 17:11:28 +0200
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-08-17 17:11:28 +0200
commit78a23b24cfd8517777283e7b2df1a45b1f858ecb (patch)
tree7814238cc8aaf6f3eaa507a98f3d375cd21d1b48 /src
parentba9103e1cb40e52b0afa069f2796226de1768d3c (diff)
livestreamer.plugins.ownedtv: Add alternative CDNs to stream list.
Diffstat (limited to 'src')
-rw-r--r--src/livestreamer/plugins/ownedtv.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/livestreamer/plugins/ownedtv.py b/src/livestreamer/plugins/ownedtv.py
index 418dd07..132dd93 100644
--- a/src/livestreamer/plugins/ownedtv.py
+++ b/src/livestreamer/plugins/ownedtv.py
@@ -58,11 +58,10 @@ class OwnedTV(Plugin):
return (channelid, swfurl)
-
def _get_streams(self):
(channelid, swfurl) = self._get_channel_info(self.url)
- if not channelid:
+ if not (channelid and swfurl):
raise NoStreamsError(self.url)
self.logger.debug("Fetching stream info")
@@ -90,17 +89,27 @@ class OwnedTV(Plugin):
base = self.CDN[ref]
for streamel in item.getElementsByTagName("stream"):
+ altcount = 1
name = streamel.getAttribute("label").lower().replace(" ", "_")
playpath = streamel.getAttribute("name")
+ stream = RTMPStream({
+ "rtmp": ("{0}/{1}").format(base, playpath),
+ "live": True,
+ "swfhash": swfhash,
+ "swfsize": swfsize,
+ "pageUrl": self.url
+ })
+
if not name in streams:
- streams[name] = RTMPStream({
- "rtmp": ("{0}/{1}").format(base, playpath),
- "live": True,
- "swfhash": swfhash,
- "swfsize": swfsize,
- "pageUrl": self.url
- })
+ streams[name] = stream
+ else:
+ if altcount == 1:
+ streams[name + "_alt"] = stream
+ else:
+ streams[name + "_alt" + str(altcount)] = stream
+
+ altcount += 1
return streams