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! 此拉取请求引入了一项新功能,允许用户根据文件的名称对本地文件进行排序。这对于那些希望按照文件名(例如,"01 - Track 01.wav")来组织和播放本地专辑的用户来说,能够确保歌曲以正确的顺序呈现,从而显著提升了本地音乐库的管理体验。 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
|
src/components/List/SongList.vue
Outdated
| // 从路径中提取文件名 | ||
| const getFileName = (path?: string) => { | ||
| if (!path) return ""; | ||
| return path.split(/[\\/]/).pop() || ""; | ||
| }; | ||
| const fileNameA = getFileName(a.path); | ||
| const fileNameB = getFileName(b.path); |
|
现已支持按照曲目序号排序(虽然超出了PR的范围) |
| case "filename": { | ||
| const fileNameA = a.path?.split(/[\\/]/).pop() || ""; | ||
| const fileNameB = b.path?.split(/[\\/]/).pop() || ""; | ||
| result = fileNameA.localeCompare(fileNameB, "zh-CN"); |
There was a problem hiding this comment.
localeCompare 默认不仅行数字敏感排序,如果文件名为 1.mp3, 10.mp3, 2.mp3,默认排序结果可能是 1, 10, 2。建议加上 numeric: true
There was a problem hiding this comment.
实际上,从 localeCompare 改成 Intl.Collator 来排序可能更好,在 sort 循环中反复调用 localeCompare 性能比较糟糕。不过只是非阻塞性建议,可采纳可不采纳吧
支持按照文件名排序本地文件,以便对
这样的本地专辑保持正确顺序。