From 78a23b24cfd8517777283e7b2df1a45b1f858ecb Mon Sep 17 00:00:00 2001 From: Christopher Rosell Date: Fri, 17 Aug 2012 17:11:28 +0200 Subject: livestreamer.plugins.ownedtv: Add alternative CDNs to stream list. --- src/livestreamer/plugins/ownedtv.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src') 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 -- cgit v1.2.3