1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

viafree._autoname: In some cases we dont have episode info.

This commit is contained in:
Johan Andersson 2018-06-03 15:50:34 +02:00
parent 2a94b927d0
commit 70bffe6f5e

View File

@ -169,7 +169,7 @@ class Viaplay(Service, OpenGraphThumbMixin):
else: else:
yield subtitle(copy.copy(self.config), subtype, dataj["subtitles_for_hearing_impaired"], output=self.output) yield subtitle(copy.copy(self.config), subtype, dataj["subtitles_for_hearing_impaired"], output=self.output)
if streamj["streams"]["medium"]: if streamj["streams"]["medium"] and streamj["streams"]["medium"] != "[empty]":
filename = streamj["streams"]["medium"] filename = streamj["streams"]["medium"]
if ".f4m" in filename: if ".f4m" in filename:
streams = hdsparse(self.config, self.http.request("get", filename, params={"hdcore": "3.7.0"}), streams = hdsparse(self.config, self.http.request("get", filename, params={"hdcore": "3.7.0"}),
@ -264,10 +264,10 @@ class Viaplay(Service, OpenGraphThumbMixin):
title = None title = None
if "season" in dataj["format_position"]: if "season" in dataj["format_position"]:
if dataj["format_position"]["season"] > 0: if dataj["format_position"]["season"] and dataj["format_position"]["season"] > 0:
season = dataj["format_position"]["season"] season = dataj["format_position"]["season"]
if season: if season:
if len(dataj["format_position"]["episode"]) > 0: if dataj["format_position"]["episode"] and len(dataj["format_position"]["episode"]) > 0:
episode = dataj["format_position"]["episode"] episode = dataj["format_position"]["episode"]
if episode: if episode:
try: try:
@ -276,7 +276,9 @@ class Viaplay(Service, OpenGraphThumbMixin):
title = episode title = episode
episode = None episode = None
else: else:
title = filenamify(dataj["title"]) title = dataj["summary"].replace("{} - ".format(dataj["format_title"]), "")
if title[-1] == ".":
title = title[:len(title) - 1] # remove the last dot
if dataj["type"] == "clip": if dataj["type"] == "clip":
# Removes the show name from the end of the filename # Removes the show name from the end of the filename
@ -298,8 +300,8 @@ class Viaplay(Service, OpenGraphThumbMixin):
episode = datajparent["format_position"]["episode"] episode = datajparent["format_position"]["episode"]
self.output["title"] = program self.output["title"] = program
self.output["season"] = int(season) self.output["season"] = season
self.output["episode"] = int(episode) self.output["episode"] = episode
self.output["episodename"] = title self.output["episodename"] = title
return True return True