Verbosity V1.0.6

This commit is contained in:
Patryk Mazur
2026-04-22 20:19:15 +02:00
parent 3658d6a49f
commit b237789f4b
3 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -35,12 +35,15 @@ def download_video(yt_url: str) -> dict:
with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
try:
print(f'Pobieranie {yt_url}')
info = ydl.extract_info(yt_url, download=False)
except Exception as e:
print(f'Nie można pobrać metadanych: {e}')
return {'status': 'error', 'message': f'Nie można pobrać metadanych: {e}'}
duration = info.get('duration', 0)
if duration > MAX_DUR:
print(f'Wideo jest za długie ({duration // 60}m {duration % 60}s). Maksymalnie {MAX_DUR // 60}m {MAX_DUR % 60}s.')
return {
'status': 'error',
'message': f'Wideo jest za długie ({duration // 60}m {duration % 60}s). Maksymalnie {MAX_DUR // 60}m {MAX_DUR % 60}s.'
@@ -58,10 +61,9 @@ def download_video(yt_url: str) -> dict:
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
try:
print(f'Pobieranie {yt_url}')
info = ydl.extract_info(yt_url, download=True)
filename = ydl.prepare_filename(info)
print(f'Pobrano {yt_url}')
print(f'Pobrano {filename} ({yt_url})')
except Exception as e:
print(f'Błąd pobierania: {e}')
return {'status': 'error', 'message': f'Błąd pobierania: {e}'}