Add temp file skip mechanism for large video downloads

This commit is contained in:
vvzvlad
2025-02-07 03:17:53 +03:00
parent 3fa6d745d6
commit 77cc68e4e1
+5 -1
View File
@@ -281,8 +281,12 @@ async def download_new_files(media_files: list, cache_dir: str):
post_dir = os.path.join(channel_dir, str(post_id))
os.makedirs(post_dir, exist_ok=True)
# Skip if temp file exists (large videos)
temp_path = os.path.join(post_dir, f"temp_{file_unique_id}")
if os.path.exists(temp_path):
continue
cache_path = os.path.join(post_dir, file_unique_id)
if not os.path.exists(cache_path):
files_to_download += 1
logger.debug(f"Background download started for {channel}/{post_id}/{file_unique_id}")