feat(dl): Skip video lang filter if --v-lang unused & only 1 video lang

This hopefully improves user-experience for anyone using Devine mainly for content outside the English language. For example, if you do -l it and there's only English video track's available, then there's really no need to filter by language and fail.

However, it still attempts filtering if you explicitly used --v-lang. If the user expected all episodes to be French by using `--v-lang fr`, and the service had one random episode in English, then the user would very likely want to be informed to verify and decide how they want to deal with it if it really was English.
This commit is contained in:
rlaphoenix 2024-03-02 12:54:17 +00:00
parent a7c2210f0b
commit f510095bcf
1 changed files with 7 additions and 1 deletions

View File

@ -376,7 +376,13 @@ class dl:
sys.exit(1)
video_languages = v_lang or lang
if video_languages and "all" not in video_languages:
if (
(v_lang and "all" not in v_lang) or
(lang and "all" not in lang and any(
x.language != title.tracks.videos[0].language
for x in title.tracks.videos
))
):
title.tracks.videos = title.tracks.by_language(title.tracks.videos, video_languages)
if not title.tracks.videos:
self.log.error(f"There's no {video_languages} Video Track...")