1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-28 06:04:17 +01:00

tv4play: free videos with premuim showed up as None

This commit is contained in:
Johan Andersson 2016-04-30 14:10:43 +02:00
parent 03a6307f38
commit 5cf6e0fe45

View File

@ -163,6 +163,13 @@ class Tv4play(Service, OpenGraphThumbMixin):
return i["title"] return i["title"]
return self._get_clip_info(vid) return self._get_clip_info(vid)
def _getdays(self, data, text):
try:
days = int(data["availability"][text])
except (ValueError, TypeError):
days = 999
return days
def find_all_episodes(self, options): def find_all_episodes(self, options):
premium = False premium = False
if options.username and options.password: if options.username and options.password:
@ -181,10 +188,10 @@ class Tv4play(Service, OpenGraphThumbMixin):
else: else:
text = "availability_group_free" text = "availability_group_free"
try: days = self._getdays(i, text)
days = int(i["availability"][text]) if premium and days == 0:
except (ValueError, TypeError): days = self._getdays(i, "availability_group_free")
days = 999
if days > 0: if days > 0:
video_id = i["id"] video_id = i["id"]
url = "http://www.tv4play.se/program/%s?video_id=%s" % ( url = "http://www.tv4play.se/program/%s?video_id=%s" % (