Skip to content

The only downloader you need. 下载器的集大成者。

fix(download): 修复下载任务清理逻辑中的文件路径错误

XiaoYouChR469d5625c89c
diff --git a/features/ffmpeg_pack/task.py b/features/ffmpeg_pack/task.py
index 1058f5a6..aebf3460 100644
--- a/features/ffmpeg_pack/task.py
+++ b/features/ffmpeg_pack/task.py
@@ -247,7 +247,7 @@ class FFmpegWorker(Worker):
def _cleanupSourceFiles(self):
for rawPath in (self.stage.videoPath, self.stage.audioPath):
target = Path(rawPath)
- for path in (target, Path(str(target) + ".ghd")):
+ for path in (target, Path(rawPath + ".ghd")):
try:
if path.is_file() or path.is_symlink():
path.unlink()
diff --git a/features/http_pack/task.py b/features/http_pack/task.py
index ed53b6a1..fe76e550 100644
--- a/features/http_pack/task.py
+++ b/features/http_pack/task.py
@@ -284,6 +284,7 @@ class HttpWorker(Worker):
self.subworkers: list[HttpSubworker] = []
self.client = niquests.AsyncSession(happy_eyeballs=True)
self.client.trust_env = False
+ shouldCleanupRecordFile = False
restored = self.restoreProgress()
if not restored:
@@ -308,7 +309,7 @@ class HttpWorker(Worker):
self.taskGroup.create_task(self.handleSubworker(subworker))
self.stage.setStatus(TaskStatus.COMPLETED)
- self._cleanupRecordFile()
+ shouldCleanupRecordFile = True
logger.info(f"{self.stage.resolvePath} 下载完成")
except CancelledError:
self.stage.setStatus(TaskStatus.PAUSED)
@@ -322,3 +323,5 @@ class HttpWorker(Worker):
with suppress(asyncio.CancelledError):
await supervisor
os.close(self.fileHandle)
+ if shouldCleanupRecordFile:
+ self._cleanupRecordFile()