From f510095bcf1abed61c4c4cff6c102548159aeeb5 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 2 Mar 2024 12:54:17 +0000 Subject: [PATCH] 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. --- devine/commands/dl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devine/commands/dl.py b/devine/commands/dl.py index 6ffc235..3b36c71 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -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...")