Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

封面图重复下载 #399

Open
9ihbd2DZSMjtsf7vecXjz opened this issue Jan 31, 2025 · 1 comment
Open

封面图重复下载 #399

9ihbd2DZSMjtsf7vecXjz opened this issue Jan 31, 2025 · 1 comment

Comments

@9ihbd2DZSMjtsf7vecXjz
Copy link

当开启 "original_cover": true,
已经下载过的视频的封面图会无限次数的被重复下载, 删除封面图文件后,再下次在611q模式下运行main.py,程序依然会每次都重复下载以前所有视频的封面图

请问大家遇到过这个情况吗, 怎么解决的? 感谢指点

Copy link

dosubot bot commented Jan 31, 2025

I found a similar open issue where the suggested solution is that files that already exist are automatically skipped without any prompt, and the download record only affects videos, albums, and live works files [1].

To prevent the cover image from being repeatedly downloaded when "original_cover": true is enabled in 611q mode, ensure that the cover image is not added to the download tasks if it already exists. The download_cover method in the Downloader class checks if the cover image exists before adding it to the download tasks:

def download_cover(
        self,
        tasks: list,
        name: str,
        id_: str,
        item: SimpleNamespace,
        temp_root: Path,
        actual_root: Path,
        original_suffix: str = "jpeg",
        dynamic_suffix: str = "webp",
        **kwargs,
) -> None:
    if all((self.original,
            url := item["origin_cover"],
            not self.is_exists(p := actual_root.with_name(f"{name}.{original_suffix}"))
            )):
        tasks.append((
            url,
            temp_root.with_name(f"{name}.{original_suffix}"),
            p,
            f"【封面】{name}",
            id_,
            original_suffix,
        ))

The condition not self.is_exists(p := actual_root.with_name(f"{name}.{original_suffix}")) checks if the file already exists at the target location. If it does, the cover image is not added to the download tasks, thus preventing repeated downloads. Ensure that this logic is correctly implemented and that the is_exists method accurately checks for the file's existence [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant