Use readlines() over readline() to avoid while

This commit is contained in:
henryruhs 2024-12-21 19:38:09 +01:00
parent 8b4e7a7410
commit 8b87147200
2 changed files with 8 additions and 4 deletions

View File

@ -47,8 +47,10 @@ def get_static_download_size(url : str) -> int:
lines = reversed(process.stdout.readlines())
for line in lines:
if 'content-length:' in line.decode().lower():
_, content_length = line.decode().lower().split('content-length:')
__line__ = line.decode().lower()
if 'content-length:' in __line__:
_, content_length = __line__.split('content-length:')
return int(content_length)
return 0

View File

@ -25,8 +25,10 @@ def run_ffmpeg_with_progress(args: List[str], update_progress : UpdateProgress)
lines = process.stdout.readlines()
for line in lines:
if 'frame=' in line.decode().lower():
_, frame_number = line.decode().lower().split('frame=')
__line__ = line.decode().lower()
if 'frame=' in __line__:
_, frame_number = __line__.split('frame=')
update_progress(int(frame_number))
if log_level == 'debug':