Send cached V1.0.8
This commit is contained in:
@@ -36,11 +36,12 @@ def download_video(yt_url: str) -> dict:
|
|||||||
|
|
||||||
existing = [f for f in os.listdir(DOWNLOADS) if url_hash in f]
|
existing = [f for f in os.listdir(DOWNLOADS) if url_hash in f]
|
||||||
if existing:
|
if existing:
|
||||||
print(f'Znaleziono plik "{url_hash}" ({yt_url})')
|
print(f'Znaleziono plik "{existing[0]}" ({yt_url})')
|
||||||
return {
|
return {
|
||||||
"status": "success",
|
'status': 'success',
|
||||||
"filename": os.path.join(DOWNLOADS, existing[0]),
|
'filename': os.path.join(DOWNLOADS, existing[0]),
|
||||||
"cached": True,
|
'title': {existing[0]},
|
||||||
|
'cached': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
|
with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
|
||||||
@@ -65,7 +66,6 @@ def download_video(yt_url: str) -> dict:
|
|||||||
'format': 'bestvideo+bestaudio/best',
|
'format': 'bestvideo+bestaudio/best',
|
||||||
'merge_output_format': 'mp4',
|
'merge_output_format': 'mp4',
|
||||||
'outtmpl': os.path.join(DOWNLOADS, f'%(title)s_{url_hash}.%(ext)s'),
|
'outtmpl': os.path.join(DOWNLOADS, f'%(title)s_{url_hash}.%(ext)s'),
|
||||||
"no_overwrites": True,
|
|
||||||
'quiet': True,
|
'quiet': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,5 +83,6 @@ def download_video(yt_url: str) -> dict:
|
|||||||
'filename': filename,
|
'filename': filename,
|
||||||
'title': info.get('title'),
|
'title': info.get('title'),
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
|
'cached': False,
|
||||||
'url': yt_url,
|
'url': yt_url,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user