mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2025-10-23 15:11:08 +00:00
feat(dl): Add option to include forced subtitle tracks
This commit is contained in:
@@ -148,6 +148,7 @@ class dl:
|
|||||||
help="Language wanted for Video, you would use this if the video language doesn't match the audio.",
|
help="Language wanted for Video, you would use this if the video language doesn't match the audio.",
|
||||||
)
|
)
|
||||||
@click.option("-sl", "--s-lang", type=LANGUAGE_RANGE, default=["all"], help="Language wanted for Subtitles.")
|
@click.option("-sl", "--s-lang", type=LANGUAGE_RANGE, default=["all"], help="Language wanted for Subtitles.")
|
||||||
|
@click.option("-fs", "--forced-subs", is_flag=True, default=False, help="Include forced subtitle tracks.")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--proxy",
|
"--proxy",
|
||||||
type=str,
|
type=str,
|
||||||
@@ -405,6 +406,7 @@ class dl:
|
|||||||
lang: list[str],
|
lang: list[str],
|
||||||
v_lang: list[str],
|
v_lang: list[str],
|
||||||
s_lang: list[str],
|
s_lang: list[str],
|
||||||
|
forced_subs: bool,
|
||||||
sub_format: Optional[Subtitle.Codec],
|
sub_format: Optional[Subtitle.Codec],
|
||||||
video_only: bool,
|
video_only: bool,
|
||||||
audio_only: bool,
|
audio_only: bool,
|
||||||
@@ -672,7 +674,8 @@ class dl:
|
|||||||
self.log.error(f"There's no {s_lang} Subtitle Track...")
|
self.log.error(f"There's no {s_lang} Subtitle Track...")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
title.tracks.select_subtitles(lambda x: not x.forced or is_close_match(x.language, lang))
|
if not forced_subs:
|
||||||
|
title.tracks.select_subtitles(lambda x: not x.forced or is_close_match(x.language, lang))
|
||||||
|
|
||||||
# filter audio tracks
|
# filter audio tracks
|
||||||
# might have no audio tracks if part of the video, e.g. transport stream hls
|
# might have no audio tracks if part of the video, e.g. transport stream hls
|
||||||
|
|||||||
Reference in New Issue
Block a user