feat(download): 批量下载时跳过已下载的文件并支持手动停止 - #94
Merged
wuziqian211 merged 1 commit intoSep 26, 2026
Merged
Conversation
批量下载整套课本时,若上一轮有部分文件下载失败,重新下载会把已经下载好的 文件再下一遍(并生成 “xxx (2).pdf”),导致总也下不完一整套;下载开始后也 没有停止的办法。 - 路径分配不再把 “已存在的目标文件” 当作命名冲突,批量下载时直接跳过该文件, 只下载缺失与上次失败的资源;进度标签与结束提示中显示跳过数量。 单文件下载仍由保存对话框确认覆盖,不受影响。 - 下载期间 “下载” 按钮变为 “停止下载”:排队中的任务不再发起请求,正在传输的 任务立即收尾并删除未完成的 .tmp 文件,已完成的文件保留。 close happycola233#92
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
做了什么
xxx (2).pdf),而是直接跳过,只下载缺失与上次失败的资源。跳过数量会显示在进度标签和结束提示中。单文件下载仍由保存对话框确认覆盖,行为不变。.tmp文件,已下载完成的文件保留,结束提示改为 “下载已停止”。为什么
#92 反映了两个实际问题:整套课本里总有部分文件下载失败,重新下载时已下载好的文件又被下一遍,「总下不完全套」;并且下载开始后无法停止。
由于临时文件重命名是下载的最后一步,目标文件存在即说明上一轮已完整下载,可以安全跳过;
.tmp仍然要避开,因为它可能属于另一个正在运行的程序实例。如何验证
tests/test_download_batch.py新增 3 个测试:只下载缺失的文件、整批已下载时不启动线程、停止后保留已完成文件并清掉未完成的.tmp;tests/test_download_paths.py中已完成文件的路径断言随行为更新。99 passed(unittest 运行tests/全部用例)。flake8 src tests --select=E9,F63,F7,F82输出 0。close #92