From db6fa79e48ddce14b6626496c1ff3184370e5e59 Mon Sep 17 00:00:00 2001 From: trickerer01 Date: Sun, 15 Sep 2024 19:52:18 +0700 Subject: [PATCH] Check for parallel download right before opening file for write --- src/download.py | 7 +++++++ src/version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/download.py b/src/download.py index 60c5a43..4d2c89f 100644 --- a/src/download.py +++ b/src/download.py @@ -261,6 +261,7 @@ async def download_sceenshots(vi: VideoInfo) -> DownloadResult: async def download_video(vi: VideoInfo) -> DownloadResult: dwn = VideoDownloadWorker.get() retries = 0 + exact_quality = False ret = DownloadResult.SUCCESS skip = Config.dm == DOWNLOAD_MODE_SKIP status_checker = ThrottleChecker(vi) @@ -363,6 +364,12 @@ async def download_video(vi: VideoInfo) -> DownloadResult: total_str = f' / {vi.expected_size / Mem.MB:.2f}' if file_size else '' Log.info(f'Saving{starting_str} {vi.sdname} {content_len / Mem.MB:.2f}{total_str} Mb to {vi.sffilename}') + if Config.continue_mode and exact_quality: + proc_str = is_file_being_used(vi.my_fullpath) + if proc_str: + Log.error(f'Error: file {vi.sffilename} already exists and is locked by \'{proc_str}\'!! Parallel download? Aborted!') + return DownloadResult.FAIL_ALREADY_EXISTS + dwn.add_to_writes(vi) vi.set_state(VideoInfo.State.WRITING) status_checker.run() diff --git a/src/version.py b/src/version.py index cfe33c3..9ce80c7 100644 --- a/src/version.py +++ b/src/version.py @@ -9,7 +9,7 @@ APP_NAME = 'NM' APP_VER_MAJOR = '1' APP_VER_SUB = '8' -APP_REVISION = '441' +APP_REVISION = '442' APP_VERSION = f'{APP_VER_MAJOR}.{APP_VER_SUB}.{APP_REVISION}' #