From 2e697d93fc91d6c6ffb9f6d72308ea4d3842f93f Mon Sep 17 00:00:00 2001 From: rlaphoenix <17136956+rlaphoenix@users.noreply.github.com> Date: Wed, 15 May 2024 14:00:38 +0100 Subject: [PATCH] fix(dl): Log output from mkvmerge on failure --- devine/commands/dl.py | 4 +++- devine/core/tracks/tracks.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/devine/commands/dl.py b/devine/commands/dl.py index 8134a8c..43b4d6a 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -701,15 +701,17 @@ class dl: ): for task_id, task_tracks in multiplex_tasks: progress.start_task(task_id) # TODO: Needed? - muxed_path, return_code = task_tracks.mux( + muxed_path, return_code, output = task_tracks.mux( str(title), progress=partial(progress.update, task_id=task_id), delete=False ) muxed_paths.append(muxed_path) if return_code == 1: + self.log.warning(output) self.log.warning("mkvmerge had at least one warning, will continue anyway...") elif return_code >= 2: + self.log.warning(output) self.log.error(f"Failed to Mux video to Matroska file ({return_code})") sys.exit(1) for video_track in task_tracks.videos: diff --git a/devine/core/tracks/tracks.py b/devine/core/tracks/tracks.py index 179c8a5..abe9657 100644 --- a/devine/core/tracks/tracks.py +++ b/devine/core/tracks/tracks.py @@ -316,7 +316,7 @@ class Tracks: ][:per_language or None]) return selected - def mux(self, title: str, delete: bool = True, progress: Optional[partial] = None) -> tuple[Path, int]: + def mux(self, title: str, delete: bool = True, progress: Optional[partial] = None) -> tuple[Path, int, str]: """ Multiplex all the Tracks into a Matroska Container file. @@ -410,15 +410,17 @@ class Tracks: # let potential failures go to caller, caller should handle try: + output = "" p = subprocess.Popen([ *cl, "--output", str(output_path), "--gui-mode" ], text=True, stdout=subprocess.PIPE) for line in iter(p.stdout.readline, ""): + output += line if "progress" in line: progress(total=100, completed=int(line.strip()[14:-1])) - return output_path, p.wait() + return output_path, p.wait(), output finally: if chapters_path: # regardless of delete param, we delete as it's a file we made during muxing