From 6de49d1981a1da3426b9b1ab1a24581fafce76ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sun, 30 Dec 2018 18:30:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=AD=8C=E6=9B=B2=E6=89=AB?= =?UTF-8?q?=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/audio/index.js | 9 ++++++--- js/modules/local.js | 12 +++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) 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())