fix(dl): Add single mux job if there's no video tracks

Fixes regression from v3.1.0 with --audio-only, --subs-only and --chapters-only.
This commit is contained in:
rlaphoenix 2024-03-08 19:06:21 +00:00
parent eeccdc37cf
commit 4c395edc53
1 changed files with 10 additions and 7 deletions

View File

@ -622,17 +622,19 @@ class dl:
)
multiplex_tasks: list[tuple[TaskID, Tracks]] = []
for video_track in title.tracks.videos:
for video_track in title.tracks.videos or [None]:
task_description = "Multiplexing"
if len(quality) > 1:
task_description += f" {video_track.height}p"
if len(range_) > 1:
task_description += f" {video_track.range.name}"
if video_track:
if len(quality) > 1:
task_description += f" {video_track.height}p"
if len(range_) > 1:
task_description += f" {video_track.range.name}"
task_id = progress.add_task(f"{task_description}...", total=None, start=False)
task_tracks = Tracks(title.tracks) + title.tracks.chapters
task_tracks.videos = [video_track]
if video_track:
task_tracks.videos = [video_track]
multiplex_tasks.append((task_id, task_tracks))
@ -653,7 +655,8 @@ class dl:
elif return_code >= 2:
self.log.error(f"Failed to Mux video to Matroska file ({return_code})")
sys.exit(1)
task_tracks.videos[0].delete()
for video_track in task_tracks.videos:
video_track.delete()
for track in title.tracks:
track.delete()
else: