1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +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"] vid = data["video"]["svtId"]
for seasons in data["associatedContent"]: for seasons in data["associatedContent"]:
for i in seasons["items"]: for i in seasons["items"]:
if i["item"]["videoSvtId"] == vid and "positionInSeason" in i["item"]: if i["item"]["videoSvtId"] == vid:
match = re.search(r"Avsnitt (\d+)", i["item"]["positionInSeason"]) if "positionInSeason" in i["item"]:
if match: match = re.search(r"Avsnitt (\d+)", i["item"]["positionInSeason"])
return match.group(1) if match:
return match.group(1)
if "number" in i["item"]:
return i["item"]["number"]
if "description" in data: if "description" in data:
match = re.search(r"Del (\d+) av (\d+)", data["description"]) 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')}") raise error.UIException(f"Can't find any streams with that audio language {config.get('audio_language')}")
if config.get("resolution"): if config.get("resolution"):
resolutions = str(config.get("resolution")).split(",") resolutions = config.get("resolution").split(",")
streams = resolution(streams, resolutions) streams = resolution(streams, resolutions)
if not streams: if not streams:
raise error.UIException(f"Can't find any streams with that video resolution {config.get('resolution')}") raise error.UIException(f"Can't find any streams with that video resolution {config.get('resolution')}")