From 07d3a44dae2bcaea1e5bffabe7a206ab70ebd7b1 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Mon, 7 Oct 2024 08:57:01 +0200 Subject: [PATCH] Fix ruff format errors --- yt_dlp/postprocessor/common.py | 2 +- yt_dlp/postprocessor/ffmpeg.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/yt_dlp/postprocessor/common.py b/yt_dlp/postprocessor/common.py index 1d795b7fb..8c7420d3f 100644 --- a/yt_dlp/postprocessor/common.py +++ b/yt_dlp/postprocessor/common.py @@ -204,7 +204,7 @@ def _prepare_multiline_status(self, lines=1): self._multiline = MultilineLogger(self._downloader.params['logger'], lines) elif self._downloader.params.get('progress_with_newline'): self._multiline = BreaklineStatusPrinter(self._downloader._out_files.out, lines) - elif hasattr(self._downloader, "_out_files"): + elif hasattr(self._downloader, '_out_files'): self._multiline = MultilinePrinter(self._downloader._out_files.out, lines, not self._downloader.params.get('quiet')) else: self._multiline = MultilinePrinter(sys.stdout, lines, not self._downloader.params.get('quiet')) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 6d0555160..c0925cb6e 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -1254,11 +1254,11 @@ def _track_ffmpeg_progress(self): self._duration_to_track, self._total_duration = self._compute_duration_to_track() self._total_filesize = self._compute_total_filesize(self._duration_to_track, self._total_duration) self._status = { - 'filename': self._ffmpeg_args[-3].split(":")[-1], + 'filename': self._ffmpeg_args[-3].split(':')[-1], 'status': 'ffmpeg_running', 'total_bytes': self._total_filesize, 'elapsed': 0, - 'outputted': 0 + 'outputted': 0, } out_listener = Thread( @@ -1278,7 +1278,7 @@ def _track_ffmpeg_progress(self): self._status.update({ 'status': 'finished', - 'outputted': self._total_filesize + 'outputted': self._total_filesize, }) time.sleep(.5) # Needed if ffmpeg didn't release the file in time for yt-dlp to change its name return self._streams[0], self._streams[1], retcode @@ -1315,7 +1315,7 @@ def _wait_for_ffmpeg(self): time.sleep(.01) self._handle_lines() self._status.update({ - 'elapsed': time.time() - self._start_time + 'elapsed': time.time() - self._start_time, }) self._hook_progress(self._status, self._info_dict) retcode = self.ffmpeg_proc.poll() @@ -1351,8 +1351,7 @@ def _compute_total_filesize(self, duration_to_track, total_duration): filesize = self._info_dict.get('filesize') if not filesize: filesize = self._info_dict.get('filesize_approx', 0) - total_filesize = filesize * duration_to_track // total_duration - return total_filesize + return filesize * duration_to_track // total_duration def _compute_duration_to_track(self): duration = self._info_dict.get('duration') @@ -1394,8 +1393,8 @@ def _compute_eta(ffmpeg_prog_infos, duration_to_track): @staticmethod def ffmpeg_time_string_to_seconds(time_string): ffmpeg_time_seconds = 0 - hms_parsed = re.match(r"((?P\d+):)?((?P\d+):)?(?P\d+)(\.(?P\d+))?", time_string) - smu_parse = re.match(r"(?P