1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 13:44:14 +01:00

svtplay: improve detection of episode number

This commit is contained in:
Johan Andersson 2023-04-09 21:32:39 +02:00
parent cbfd09f6b0
commit 46077b7cd2
2 changed files with 8 additions and 5 deletions

View File

@ -322,10 +322,13 @@ class Svtplay(Service, MetadataThumbMixin):
vid = data["video"]["svtId"]
for seasons in data["associatedContent"]:
for i in seasons["items"]:
if i["item"]["videoSvtId"] == vid and "positionInSeason" in i["item"]:
match = re.search(r"Avsnitt (\d+)", i["item"]["positionInSeason"])
if match:
return match.group(1)
if i["item"]["videoSvtId"] == vid:
if "positionInSeason" in i["item"]:
match = re.search(r"Avsnitt (\d+)", i["item"]["positionInSeason"])
if match:
return match.group(1)
if "number" in i["item"]:
return i["item"]["number"]
if "description" in data:
match = re.search(r"Del (\d+) av (\d+)", data["description"])

View File

@ -166,7 +166,7 @@ def select_quality(config, streams):
raise error.UIException(f"Can't find any streams with that audio language {config.get('audio_language')}")
if config.get("resolution"):
resolutions = str(config.get("resolution")).split(",")
resolutions = config.get("resolution").split(",")
streams = resolution(streams, resolutions)
if not streams:
raise error.UIException(f"Can't find any streams with that video resolution {config.get('resolution')}")