refactor(download): 重构下载管理器以支持自定义下载类型 将自定义下载相关字段从 SongType 中分离,新增独立的 CustomDownloadType 类型。重构下载管理器实现策略模式,将歌曲下载和自定义下载分别封装为 SongDownloadStrategy 和 CustomDownloadStrategy 类,统一通过 DownloadStrategy 接口处理。同时提取歌词处理逻辑到 LyricHelper 辅助类,优化代码结构和可维护性。 - #829
Conversation
- 拆分过长的 import 语句为多行 - 调整条件运算符和长字符串的换行以符合代码规范 - 统一代码缩进和括号风格 - 移除行尾多余的空格
将自定义下载相关字段从 SongType 中分离,新增独立的 CustomDownloadType 类型。重构下载管理器实现策略模式,将歌曲下载和自定义下载分别封装为 SongDownloadStrategy 和 CustomDownloadStrategy 类,统一通过 DownloadStrategy 接口处理。同时提取歌词处理逻辑到 LyricHelper 辅助类,优化代码结构和可维护性。
- 将 LyricHelper 类重构为纯函数式的 LyricProcessor 模块,减少对 Store 的直接依赖 - 为 CustomDownloadType 添加 type 字段以支持 discriminated union - 在下载管理器启动时迁移旧的自定义下载任务数据 - 统一歌词处理选项传递方式,提高代码可测试性和可维护性
- 将逐字歌词获取逻辑从 LyricProcessor 移至 DownloadManager - 引入 generateVerbatimContent 和 generateAssContent 纯函数生成文件内容 - 统一处理旧数据迁移中的 type 字段推断逻辑 - 保持原有功能不变,提高代码可测试性和模块化
确保在应用启动时统一处理旧数据的 type 字段迁移,避免在下载过程中重复执行。这解决了下载管理器可能因迁移逻辑而延迟初始化的问题,并保证了数据一致性。
新增 `save-file` IPC 处理器,支持将内容写入指定路径的文件。处理编码参数并提供错误日志记录。
Summary of ChangesHello @kazukokawagawa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求对下载管理系统进行了重大改进,通过引入策略模式和专用类型,增强了对自定义下载的支持。歌词处理功能被封装到独立的模块中,提升了代码结构和可维护性。这些变更使得下载流程更加灵活、健壮,并为未来的功能扩展奠定了基础。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
- 保存文件时自动创建父目录,避免因目录不存在导致的失败 - 歌词处理增加罗马音支持,当启用下载罗马音选项时生成对应歌词轨道 - 修复自定义歌曲类型识别逻辑,迁移旧字段并确保ID一致性 - 统一路径分隔符为斜杠,提高跨平台兼容性 - 改进艺术家信息拼接方式,支持多位艺术家显示
修复下载任务处理中条件判断错误,将 `downloadResult.success` 改为检查 `downloadResult.status === "success"` 以正确处理下载状态。 为歌词处理器添加翻译与罗马音合并功能,当启用相关选项时,会解析并时间轴对齐多语言歌词,最终合并输出为LRC格式。同时增强错误日志,打印任务ID和具体错误信息。
No description provided.