From 4b39ce1990eba4a74c5f05ce1722e5f7a03baa66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Mon, 7 Jan 2019 01:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AD=8C=E8=AF=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=92=8C=E8=A7=A3=E6=9E=90=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/modules/local.js | 2 ++ lib/lyrics/index.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/js/modules/local.js b/js/modules/local.js index 7adb38d..bcce2cc 100644 --- a/js/modules/local.js +++ b/js/modules/local.js @@ -115,6 +115,8 @@ export default Anot({ fs.echo(json.lyrics, it.lyrics) fs.echo(JSON.stringify(LS.getAll(), '', 2), MUSIC_DB_PATH) + + LYRICS.__init__(it.lyrics) }) } }) diff --git a/lib/lyrics/index.js b/lib/lyrics/index.js index 4c8966b..c6ba83a 100644 --- a/lib/lyrics/index.js +++ b/lib/lyrics/index.js @@ -21,6 +21,7 @@ class Lyrics { } if (!lrcFile || !fs.exists(lrcFile)) { + log('no lrc file', lrcFile) return false } @@ -67,6 +68,16 @@ class Lyrics { } update(time) { + if (!this.lib.length) { + this.lrc = { + l: { bg: '#fff', txt: '暂无歌词...' }, + r: { bg: '', txt: '' } + } + + this.emit('ctrl-lrc', this.lrc.l.txt) + this.emit('ktv-lrc', this.lrc) + return + } if (!this.curr.length && this.tmpLib.length) { this.curr = this.tmpLib.splice(0, 2) }