-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
修正播放列表中的“修复错误的文件路径”功能在媒体库更新后还需要重启软件才能生效的问题 #761
- Loading branch information
1 parent
f02766e
commit bce59da
Showing
2 changed files
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
bce59da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用FixWrongFilePath时需要加m_shared_mutex读锁
因为m_song_file_name_map读取时AddItem仍然会被反复调用
m_song_file_name_map的写入就依赖AddItem加的写锁就好
(可能不需要UpdateFileNameMap这层,直接让CSongDataManager以同等水平维护m_song_data和m_song_file_name_map即可)
不过FixWrongFilePath逻辑上仍有问题,m_song_file_name_map会同时拥有有效与无效的路径,
这使得匹配会优先使用原名即使其不存在
之前这个功能也依赖于”启动时移除不存在的文件“
确认文件是否存在很花时间,准确的说是所有文件api(如果量很大的话)
这导致一点问题,FixWrongFilePath可能需要阻塞AddItem相当一段时间,程序可能会卡一会(问题不大)
另外这个功能我觉得设计上有问题,如果文件命名随意那么极有可能匹配到错误的音频
比如如果有文件夹组织结构如下 /music/<album>/<track>.flac
之后删除了某个专辑,那么播放列表的项目就会被修复随意选择另一个专辑
对cue项目就更有问题,毕竟CDImage.xxx有那么多
不是反对这个功能,主要是UX有问题,这个功能最有可能被完全不理解它有什么用的人使用
bce59da
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lrisora 确实有些问题,我后来想想觉得没有必要让CSongDataManager维护一个m_song_file_name_map,于是我现在改成了m_song_file_name_map实时构建,并将它从CSongDataManager中删除了,实时构建并不会花太多时间。
现在会忽略cue项目,并修正了会匹配到不存在的文件的问题。