From a29ab36a580de3215f7dad0cdec3a09e2f28eae9 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Tue, 7 Dec 2021 13:35:30 -0800 Subject: [PATCH] improvements to isInLibrary --- resources/cider-ui-tests/index.js | 14 +++++++++++--- resources/cider-ui-tests/views/main.ejs | 4 ++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/resources/cider-ui-tests/index.js b/resources/cider-ui-tests/index.js index 195dc9a2..b4e53abf 100644 --- a/resources/cider-ui-tests/index.js +++ b/resources/cider-ui-tests/index.js @@ -346,11 +346,11 @@ const app = new Vue({ return await this.mkapi(method, library, term, params, params2, attempts + 1) } }, - async getLibrarySongsFull() { + async getLibrarySongsFull(force = false) { let self = this let library = [] let downloaded = null; - if (this.library.songs.downloadState == 2 || this.library.songs.downloadState == 1) { + if ((this.library.songs.downloadState == 2 || this.library.songs.downloadState == 1) && !force) { return } if(localStorage.getItem("librarySongs") != null) { @@ -855,9 +855,17 @@ const app = new Vue({ self.search.results = results }) }, - isInLibrary(id) { + isInLibrary(playParams) { let self = this + let id = "" // ugly code to check if current playback item is in library + if(playParams.catalogId) { + id = playParams.catalogId + }else if(playParams.id) { + id = playParams.id + }else if(playParams.isLibrary) { + return true + } var found = this.library.songs.listing.filter((item)=>{ if(item["attributes"]){ if(item["attributes"]["playParams"] && (item["attributes"]["playParams"]["catalogId"] == id)){ diff --git a/resources/cider-ui-tests/views/main.ejs b/resources/cider-ui-tests/views/main.ejs index b9b0ba11..852df620 100644 --- a/resources/cider-ui-tests/views/main.ejs +++ b/resources/cider-ui-tests/views/main.ejs @@ -75,8 +75,8 @@ :max="mk.currentPlaybackDuration" :value="playerLCD.playbackDuration"> -