mirror of
https://github.com/imsyy/SPlayer.git
synced 2026-04-25 06:55:57 +03:00
[PR #866] [CLOSED] refactor: 提升代码质量 - 类型安全、消除重复、修复数据转换 #694
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/imsyy/SPlayer/pull/866
Author: @Copilot
Created: 2/11/2026
Status: ❌ Closed
Base:
dev-dl-rust← Head:copilot/sub-pr-864📝 Commits (4)
0c9f031Initial plan985950a🐛 fix: 修复数据转换逻辑,恢复 size 和 duration 的正确格式f669747✨ refactor: 提升代码质量,增强类型安全和可维护性797a9cc♻️ refactor: 提取共享路径工具函数,消除代码重复📊 Changes
7 files changed (+110 additions, -42 deletions)
View changed files
📝
electron/main/database/LocalMusicDB.ts(+13 -6)📝
electron/main/ipc/ipc-file.ts(+4 -15)📝
electron/main/services/LocalMusicService.ts(+27 -11)📝
electron/main/utils/format.ts(+30 -6)➕
electron/main/utils/paths.ts(+29 -0)📝
src/utils/color.ts(+5 -3)📝
src/views/Local/layout.vue(+2 -1)📄 Description
代码审查发现类型安全问题、数据转换错误和代码重复。本次重构修复这些问题并提升整体代码质量。
修复数据转换错误
processMusicList: 恢复duration秒转毫秒和size字节保留(前端需要原始字节数供formatFileSize处理)Local/layout.vue: 修复allMusicSize计算(字节 → GB)消除
any类型,增强类型安全Artist、ProcessedMusicTrack、ScanEvent(含Progress/Batch/End子类型)getArtistNames的any参数: 使用Artist | Artist[](err, event: ScanEvent | null) => void消除代码重复
创建
utils/paths.ts统一路径管理,消除ipc-file.ts和LocalMusicService中的重复getCoverDir实现(-15 行):其他优化
LocalMusicDB.escapeLike为私有方法() => {}质量验证: ✅ Code Review (0 issues) | ✅ CodeQL (0 alerts)
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.