This commit is contained in:
henryruhs 2024-12-21 17:30:05 +01:00
parent 5e6b3d55c2
commit 3a254f428c
3 changed files with 9 additions and 11 deletions

View File

@ -49,10 +49,9 @@ def get_static_download_size(url : str) -> int:
while line := process.stdout.readline().decode().lower():
if 'content-length:' in line:
_, content_length = line.split('content-length:')
content_length = int(content_length)
if content_length > 0:
return content_length
if int(content_length) > 0:
return int(content_length)
return 0

View File

@ -26,10 +26,9 @@ def run_ffmpeg_with_progress(args: List[str], update_progress : UpdateProgress)
while line := process.stdout.readline().decode().lower():
if 'frame=' in line:
_, frame_number = line.split('frame=')
frame_number = int(frame_number)
if frame_number > 0:
update_progress(frame_number)
if int(frame_number) > 0:
update_progress(int(frame_number))
if log_level == 'debug':
log_debug(process)

View File

@ -1,6 +1,6 @@
import pytest
from facefusion.download import conditional_download, get_static_download_size, ping_url
from facefusion.download import conditional_download, get_static_download_size, ping_static_url
from .helper import get_test_examples_directory
@ -12,12 +12,12 @@ def before_all() -> None:
])
def test_get_download_size() -> None:
def test_get_static_download_size() -> None:
assert get_static_download_size('https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-240p.mp4') == 191675
assert get_static_download_size('https://github.com/facefusion/facefusion-assets/releases/download/examples-3.0.0/target-360p.mp4') == 370732
assert get_static_download_size('invalid') == 0
def test_ping_url() -> None:
assert ping_url('https://github.com') is True
assert ping_url('invalid') is False
def test_static_ping_url() -> None:
assert ping_static_url('https://github.com') is True
assert ping_static_url('invalid') is False