summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Gardner <andy-g@users.noreply.github.com>2018-01-11 23:41:17 +0200
committerMartijn Kaijser <martijn@xbmc.org>2018-01-12 06:36:30 +0100
commitf8f0cf1da1813182abe7bf367aee0c9a861d2ec3 (patch)
tree9597fbcfe5e2ecc0cb06c84908080588ca601167
parentbc1d11602c8d577fcbd68c0487e326b03af74f0f (diff)
[plugin.video.redbull.tv] v2.0.2
-rw-r--r--plugin.video.redbull.tv/__init__.py0
-rw-r--r--plugin.video.redbull.tv/addon.xml2
-rw-r--r--plugin.video.redbull.tv/resources/lib/redbulltv_client.py16
3 files changed, 13 insertions, 5 deletions
diff --git a/plugin.video.redbull.tv/__init__.py b/plugin.video.redbull.tv/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/plugin.video.redbull.tv/__init__.py
+++ /dev/null
diff --git a/plugin.video.redbull.tv/addon.xml b/plugin.video.redbull.tv/addon.xml
index 30b5626..58e8f5d 100644
--- a/plugin.video.redbull.tv/addon.xml
+++ b/plugin.video.redbull.tv/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="plugin.video.redbull.tv" name="Red Bull TV" version="2.0.1" provider-name="andy-g">
+<addon id="plugin.video.redbull.tv" name="Red Bull TV" version="2.0.2" provider-name="andy-g">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
</requires>
diff --git a/plugin.video.redbull.tv/resources/lib/redbulltv_client.py b/plugin.video.redbull.tv/resources/lib/redbulltv_client.py
index 8124273..b23075b 100644
--- a/plugin.video.redbull.tv/resources/lib/redbulltv_client.py
+++ b/plugin.video.redbull.tv/resources/lib/redbulltv_client.py
@@ -1,5 +1,5 @@
-import re, urllib2
-import utils
+import re, urllib2, os
+import resources.lib.utils as utils
class RedbullTVClient(object):
REDBULL_API = "https://appletv.redbull.tv/"
@@ -29,10 +29,15 @@ class RedbullTVClient(object):
description = element.findtext("description")
image = element.find("image").get("src1080")
url = element.findtext("mediaURL")
+ base_url = ''
# Try find the specific stream based on the users preferences
try:
- playlists = urllib2.urlopen(url).read()
+ response = urllib2.urlopen(url)
+ # Required to get base url in case of a redirect, to use for relative paths
+ base_url = response.geturl()
+ playlists = response.read()
+
resolution = self.get_resolution_code(self.resolution)
media_url = re.search(
"RESOLUTION=" + resolution + ".*\n(.*)",
@@ -42,6 +47,10 @@ class RedbullTVClient(object):
else:
url = media_url
+ # if url is relative, add the base path
+ if base_url != '' and not url.startswith('http'):
+ url = os.path.dirname(base_url) + '/' + url
+
return {"title":name, "url":url, "summary":description, "image": image, "is_stream":True}
def get_element_details(self, element, url=None):
@@ -108,4 +117,3 @@ class RedbullTVClient(object):
for item in xml_elements:
items.append(self.get_element_details(item, url))
return items
- \ No newline at end of file