Skip to content

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

fix(task): fileIndex 直接访问替代 getattr,修复 yt_dlp 优先级 bug

XiaoYouChRb0ca74a44ce4
diff --git a/features/ftp_pack/task.py b/features/ftp_pack/task.py
index 684c64d8..196c3486 100644
--- a/features/ftp_pack/task.py
+++ b/features/ftp_pack/task.py
@@ -503,7 +503,7 @@ class FtpTask(Task):
super().__post_init__()
# 旧存档中被取消勾选的文件没有 Step,按 files 补建
if self.files:
- existing = {getattr(s, "fileIndex", None) for s in self.steps}
+ existing = {s.fileIndex for s in self.steps}
for file in self.files:
if file.index not in existing:
self.addStep(FtpStep.fromFile(file, self))
diff --git a/features/huggingface_pack/task.py b/features/huggingface_pack/task.py
index 8340c795..75a08af3 100644
--- a/features/huggingface_pack/task.py
+++ b/features/huggingface_pack/task.py
@@ -59,7 +59,7 @@ class HuggingFaceTask(Task):
super().__post_init__()
# 旧存档中被取消勾选的文件没有 Step,按 files 补建
if self.files:
- existing = {getattr(s, "fileIndex", None) for s in self.steps}
+ existing = {s.fileIndex for s in self.steps}
for file in self.files:
if file.index not in existing:
self.addStep(HuggingFaceStep.fromFile(file, self))
diff --git a/features/yt_dlp_pack/task.py b/features/yt_dlp_pack/task.py
index d6970dd9..5908292c 100644
--- a/features/yt_dlp_pack/task.py
+++ b/features/yt_dlp_pack/task.py
@@ -245,7 +245,7 @@ class YouTubeExtractStep(TaskStep):
ext = "m4a" if not videoFmt else "mp4"
self.task.setName(f"{safeName}.{ext}")
for step in self.task.steps:
- if getattr(step, "fileIndex", -1) == self.fileIndex and hasattr(step, "videoStem"):
+ if step.fileIndex == self.fileIndex and hasattr(step, "videoStem"):
step.videoStem = safeName
self.setStatus(TaskStatus.COMPLETED)
@@ -320,7 +320,7 @@ class YouTubeExtractStep(TaskStep):
from .config import ytDlpConfig
for step in self.task.steps:
- if getattr(step, "fileIndex", -1) != self.fileIndex:
+ if step.fileIndex != self.fileIndex:
continue
if isinstance(step, FFmpegResourceStep):
fmt = videoFmt if step.role == "video" else audioFmt