diff --git a/dist/audio/index.js b/dist/audio/index.js index f5294cc..adb0924 100644 --- a/dist/audio/index.js +++ b/dist/audio/index.js @@ -9,6 +9,7 @@ const { exec } = require('child_process') const { EventEmitter } = require('events') const util = require('util') +const path = require('path') class AudioPlayer { constructor() { @@ -185,10 +186,12 @@ export const ID3 = song => { pc.stdout.on('close', _ => { try { let { format } = JSON.parse(buf) + let name = path.basename(song) + format.tags = format.tags || {} resolve({ - title: format.tags.TITLE || format.tags.title, - album: format.tags.ALBUM || format.tags.album, - artist: format.tags.ARTIST || format.tags.artist, + title: format.tags.TITLE || format.tags.title || name, + album: format.tags.ALBUM || format.tags.album || '', + artist: format.tags.ARTIST || format.tags.artist || '', duration: +format.duration, size: +(format.size / 1024 / 1024).toFixed(2) }) diff --git a/js/modules/local.js b/js/modules/local.js index e286679..d86def0 100644 --- a/js/modules/local.js +++ b/js/modules/local.js @@ -190,19 +190,21 @@ export default Anot({ Object.assign(song, { title: this.form.title, artist: this.form.artist, - album: this.form.album + album: this.form.album, + cover: '', + kgHash: '' }) this.list.set(this.__idx__, song) delete this.__idx__ let col = new Intl.Collator('zh') - this.list.sort((a, b) => { - return col.compare(a.artist, b.artist) - }) + // this.list.sort((a, b) => { + // return col.compare(a.artist, b.artist) + // }) LS.update(song.id, song) - LS.sort('artist', true) + // LS.sort('artist', true) SONIST.clear() SONIST.push(LS.getAll())