mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-27 21:54:17 +01:00
tv4play: Add season and episode info in the filename
This commit is contained in:
parent
c6df8f2b48
commit
c4b4ab5bef
@ -165,10 +165,24 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
||||
show = quote_plus(show)
|
||||
return show
|
||||
|
||||
def _seasoninfo(self, data):
|
||||
if "season" in data and data["season"]:
|
||||
season = "{:02d}".format(data["season"])
|
||||
episode = "{:02d}".format(data["episode"])
|
||||
if int(season) == 0 and int(episode) == 0:
|
||||
return None
|
||||
return "s%se%s" % (season, episode)
|
||||
else:
|
||||
return None
|
||||
|
||||
def _autoname(self, vid):
|
||||
jsondata = self._get_show_info()
|
||||
for i in jsondata["results"]:
|
||||
if vid == i["id"]:
|
||||
season = self._seasoninfo(i)
|
||||
if season:
|
||||
index = len(i["program"]["name"])
|
||||
return i["title"][:index] + ".%s%s" % (season, i["title"][index:])
|
||||
return i["title"]
|
||||
return self._get_clip_info(vid)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user