This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
sonist
Archived
1
0
Fork 0

修复扫描音乐会导致白屏的bug

2.x
宇天 2019-01-20 23:01:11 +08:00
parent 8e1decd7e0
commit 1064089097
1 changed files with 15 additions and 1 deletions

View File

@ -19,6 +19,8 @@ const HOME_PATH = app.getPath('appData')
const MUSIC_DB_PATH = path.join(HOME_PATH, 'music.db')
const LYRICS_PATH = path.join(HOME_PATH, 'lyrics')
const SUPPORTED_EXTS = ['.mp3', '.webm', '.ogg', '.flac', '.m4a', '.aac']
let appInit = {}
let dbCache = fs.cat(MUSIC_DB_PATH)
dbCache = JSON.parse(dbCache)
@ -179,7 +181,19 @@ export default Anot({
if (appInit.musicPath) {
if (fs.isdir(appInit.musicPath)) {
this.__load__ = layer.load(4)
this.__LIST__ = fs.ls(appInit.musicPath)
this.__LIST__ = fs.ls(appInit.musicPath, true).filter(_ => {
if (fs.isdir(_)) {
return false
} else {
let { ext, name } = path.parse(song)
if (!ext || name.startsWith('.')) {
return false
}
return SUPPORTED_EXTS.includes(ext)
}
})
this.__NEW_NUM__ = 0
ev.target.textContent = '正在扫描, 请稍候...'
this.__checkSong__(ev.target)