Use readlines() over readline() to avoid while

This commit is contained in:
henryruhs 2024-12-21 19:17:46 +01:00
parent fedd88ce4c
commit 8b4e7a7410
2 changed files with 4 additions and 6 deletions

View File

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

View File

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