Skip to content

Commit

Permalink
Check for parallel download right before opening file for write
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer01 committed Sep 15, 2024
1 parent 76bce5d commit db6fa79
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'

#
Expand Down

0 comments on commit db6fa79

Please sign in to comment.