feat: 避免含有标题的较短本地音乐因时长或文件大小而被排除#796
Conversation
Summary of ChangesHello @kyv001, 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
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
|
| // 时长 < 30s | ||
| if (metadata.format.duration && metadata.format.duration < 30) return; | ||
| // 时长 > 2h (7200s) | ||
| if (metadata.format.duration && metadata.format.duration > 7200) return; |
There was a problem hiding this comment.
为了使代码更简洁,可以将两个关于时长的 if 判断合并为一个。这样可以减少代码行数,并使过滤逻辑更紧凑。
| // 时长 < 30s | |
| if (metadata.format.duration && metadata.format.duration < 30) return; | |
| // 时长 > 2h (7200s) | |
| if (metadata.format.duration && metadata.format.duration > 7200) return; | |
| // 时长 < 30s 或 > 2h (7200s) | |
| if (metadata.format.duration && (metadata.format.duration < 30 || metadata.format.duration > 7200)) return; |
在一些专辑中(如Exhale EP - Devin Wild)会有作为过渡的短小间奏曲目。这些曲目的本地文件往往时长小于30秒或者文件大小小于1MB从而会被本地曲目扫描器排除。但这些曲目作为专辑的一部分不应被排除。
解决方案:仅当确认本地文件没有标题时将过短或过小的音频文件过滤,避免误伤短小曲目。