feat(dl): add --audio-description flag to download AD tracks

Add support for downloading audio description tracks via the --audio-description/-ad flag. Previously, descriptive audio tracks were always filtered out. Users can now optionally include them.

Fixes #33
This commit is contained in:
Andy
2025-10-24 00:53:47 +00:00
parent 3571c5eb3c
commit ec3e150846

View File

@@ -237,6 +237,7 @@ class dl:
@click.option("-ns", "--no-subs", is_flag=True, default=False, help="Do not download subtitle tracks.") @click.option("-ns", "--no-subs", is_flag=True, default=False, help="Do not download subtitle tracks.")
@click.option("-na", "--no-audio", is_flag=True, default=False, help="Do not download audio tracks.") @click.option("-na", "--no-audio", is_flag=True, default=False, help="Do not download audio tracks.")
@click.option("-nc", "--no-chapters", is_flag=True, default=False, help="Do not download chapters tracks.") @click.option("-nc", "--no-chapters", is_flag=True, default=False, help="Do not download chapters tracks.")
@click.option("-ad", "--audio-description", is_flag=True, default=False, help="Download audio description tracks.")
@click.option( @click.option(
"--slow", "--slow",
is_flag=True, is_flag=True,
@@ -582,6 +583,7 @@ class dl:
no_subs: bool, no_subs: bool,
no_audio: bool, no_audio: bool,
no_chapters: bool, no_chapters: bool,
audio_description: bool,
slow: bool, slow: bool,
list_: bool, list_: bool,
list_titles: bool, list_titles: bool,
@@ -1065,7 +1067,8 @@ class dl:
# 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
if len(title.tracks.audio) > 0: if len(title.tracks.audio) > 0:
title.tracks.select_audio(lambda x: not x.descriptive) # exclude descriptive audio if not audio_description:
title.tracks.select_audio(lambda x: not x.descriptive) # exclude descriptive audio
if acodec: if acodec:
title.tracks.select_audio(lambda x: x.codec == acodec) title.tracks.select_audio(lambda x: x.codec == acodec)
if not title.tracks.audio: if not title.tracks.audio: