diff --git a/blackhole.py b/blackhole.py index cf3357f..c1adf03 100644 --- a/blackhole.py +++ b/blackhole.py @@ -255,6 +255,9 @@ async def processFile(file: TorrentFileInfo, arr: Arr, isRadarr): def print(*values: object): _print(f"[{file.fileInfo.filenameWithoutExt}]", *values) + await asyncio.sleep(1) # Wait before processing the file in case it isn't fully written yet. + os.renames(file.fileInfo.filePath, file.fileInfo.filePathProcessing) + from concurrent.futures import ThreadPoolExecutor def read_file(path): @@ -274,9 +277,6 @@ async def is_accessible(path, timeout=10): finally: executor.shutdown(wait=False) - await asyncio.sleep(1) # Wait before processing the file in case it isn't fully written yet. - os.renames(file.fileInfo.filePath, file.fileInfo.filePathProcessing) - with open(file.fileInfo.filePathProcessing, 'rb' if file.torrentInfo.isDotTorrentFile else 'r') as f: fileData = f.read() f.seek(0)