mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-04 12:26:39 +00:00
Fix ruff format errors
This commit is contained in:
parent
de9b89b71f
commit
07d3a44dae
|
@ -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'))
|
||||
|
|
|
@ -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<Hour>\d+):)?((?P<Minute>\d+):)?(?P<Second>\d+)(\.(?P<float>\d+))?", time_string)
|
||||
smu_parse = re.match(r"(?P<Time>\d+)(?P<Unit>[mu]?s)", time_string)
|
||||
hms_parsed = re.match(r'((?P<Hour>\d+):)?((?P<Minute>\d+):)?(?P<Second>\d+)(\.(?P<float>\d+))?', time_string)
|
||||
smu_parse = re.match(r'(?P<Time>\d+)(?P<Unit>[mu]?s)', time_string)
|
||||
if hms_parsed:
|
||||
if hms_parsed.group('Hour'):
|
||||
ffmpeg_time_seconds += 3600 * int_or_none(hms_parsed.group('Hour'))
|
||||
|
@ -1416,7 +1415,7 @@ def ffmpeg_time_string_to_seconds(time_string):
|
|||
|
||||
@staticmethod
|
||||
def _compute_bitrate(bitrate):
|
||||
bitrate_str = re.match(r"(?P<Integer>\d+)(\.(?P<float>\d+))?(?P<Prefix>[gmk])?bits/s", bitrate)
|
||||
bitrate_str = re.match(r'(?P<Integer>\d+)(\.(?P<float>\d+))?(?P<Prefix>[gmk])?bits/s', bitrate)
|
||||
try:
|
||||
no_prefix_bitrate = int_or_none(bitrate_str.group('Integer'))
|
||||
if bitrate_str.group('float'):
|
||||
|
|
Loading…
Reference in a new issue