From 8782afafb087bd282ab2eb56757f111c85d64fd1 Mon Sep 17 00:00:00 2001 From: toyobayashi Date: Mon, 26 Jul 2021 21:15:36 +0800 Subject: [PATCH] feat(live): filter audios by `/ok` --- app/src/ts/renderer/mishiro-live.ts | 32 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/app/src/ts/renderer/mishiro-live.ts b/app/src/ts/renderer/mishiro-live.ts index b427cb9..6738e49 100644 --- a/app/src/ts/renderer/mishiro-live.ts +++ b/app/src/ts/renderer/mishiro-live.ts @@ -526,19 +526,35 @@ export default class extends Vue { if (this.queryString) { if (this.currentAudioType === 'BGM') { const arr = [] - const re = new RegExp(this.queryString) - for (let i = 0; i < this.bgmManifest.length; i++) { - if (re.test(this.bgmManifest[i].fileName)) { - arr.push(this.bgmManifest[i]) + if (this.queryString === '/ok') { + for (let i = 0; i < this.bgmManifest.length; i++) { + if (this.bgmManifest[i]._canplay) { + arr.push(this.bgmManifest[i]) + } + } + } else { + const re = new RegExp(this.queryString) + for (let i = 0; i < this.bgmManifest.length; i++) { + if (re.test(this.bgmManifest[i].fileName)) { + arr.push(this.bgmManifest[i]) + } } } setAudioList(arr) } else if (this.currentAudioType === 'LIVE') { const arr = [] - const re = new RegExp(this.queryString) - for (let i = 0; i < this.liveManifest.length; i++) { - if (re.test(this.liveManifest[i].fileName)) { - arr.push(this.liveManifest[i]) + if (this.queryString === '/ok') { + for (let i = 0; i < this.liveManifest.length; i++) { + if (this.liveManifest[i]._canplay) { + arr.push(this.liveManifest[i]) + } + } + } else { + const re = new RegExp(this.queryString) + for (let i = 0; i < this.liveManifest.length; i++) { + if (re.test(this.liveManifest[i].fileName)) { + arr.push(this.liveManifest[i]) + } } } setAudioList(arr)