From 77cc68e4e11db85ac9a677bac21ca78b0b975e00 Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Fri, 7 Feb 2025 03:17:53 +0300 Subject: [PATCH] Add temp file skip mechanism for large video downloads --- api_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api_server.py b/api_server.py index 194188e..1904c47 100644 --- a/api_server.py +++ b/api_server.py @@ -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}")