From f6302351dee3a07d8a64519dd30efac39722c26a Mon Sep 17 00:00:00 2001 From: smoothquark Date: Wed, 12 Mar 2025 11:19:52 +0000 Subject: [PATCH 1/3] Allow SlimBrowse to support duration SlimBrowse currently does not seem to support duration values passed by plugins to Material skin. This, together with a trial trivial change to LMS (https://github.com/LMS-Community/slimserver/pull/1348) allows Material to display track duration and total duration. Works with lms-plugin-tidal and Spotty-Plugin. --- MaterialSkin/HTML/material/html/js/browse-resp.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/MaterialSkin/HTML/material/html/js/browse-resp.js b/MaterialSkin/HTML/material/html/js/browse-resp.js index 9e543c74b..c01f1ac98 100644 --- a/MaterialSkin/HTML/material/html/js/browse-resp.js +++ b/MaterialSkin/HTML/material/html/js/browse-resp.js @@ -142,6 +142,7 @@ function parseBrowseResp(data, parent, options, cacheKey, parentCommand, parentG var maybeAllowGrid = command!="trackstat"; // && !isFavorites; // && command!="playhistory"; var numImages = 0; var numTracks = 0; + var totalDuration = 0; // support for total duration if duration has been passed as a parameter resp.isMusicMix = MIXER_APPS.has(command) && data.params[1].length>0 && (data.params[1][1]=="mix" || data.params[1][1]=="list"); resp.canUseGrid = maybeAllowGrid && (isRadiosTop || isAppsTop || isBmf || isDisksAndFolders || (data.result.window && data.result.window.windowStyle && (data.result.window.windowStyle=="icon_list" || data.result.window.windowStyle=="home_menu"))) ? true : false; @@ -693,7 +694,12 @@ function parseBrowseResp(data, parent, options, cacheKey, parentCommand, parentG i.icon = undefined; haveWithoutIcons = true; } - + + // show duration if duration has been passed as a parameter + i.duration = i.duration>0 ? i.duration : undefined, + i.durationStr = i.duration>0 ? formatSeconds(i.duration) : undefined, + totalDuration += i.duration>0 ? i.duration : 0; + resp.items.push(i); // If this is a "text" item with an image then treat as a standard actionable item if ("text"==i.type && (undefined!=i.image || undefined!=i.icon || undefined!=i.svg)) { @@ -929,6 +935,11 @@ function parseBrowseResp(data, parent, options, cacheKey, parentCommand, parentG } } } + + // show total duration if duration has been passed as a parameter + if (totalDuration>0) { + resp.subtitle+=SEPARATOR+formatSeconds(totalDuration); + } } else if (data.result.artists_loop) { var type = 0; var stdItem = parent && parent.id.startsWith("mmw") ? STD_ITEM_WORK_COMPOSER : STD_ITEM_ARTIST; From 1a42e82810f4bf05018b900929e52bd09800df5d Mon Sep 17 00:00:00 2001 From: smoothquark Date: Wed, 12 Mar 2025 15:49:25 +0000 Subject: [PATCH 2/3] Allow SlimBrowse to support duration provided as a string Allows duration passed as a string by SlimBrowse (modified lms-plugin-tidal) to be parsed correctly. --- MaterialSkin/HTML/material/html/js/browse-resp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MaterialSkin/HTML/material/html/js/browse-resp.js b/MaterialSkin/HTML/material/html/js/browse-resp.js index c01f1ac98..dd3a338a6 100644 --- a/MaterialSkin/HTML/material/html/js/browse-resp.js +++ b/MaterialSkin/HTML/material/html/js/browse-resp.js @@ -696,7 +696,7 @@ function parseBrowseResp(data, parent, options, cacheKey, parentCommand, parentG } // show duration if duration has been passed as a parameter - i.duration = i.duration>0 ? i.duration : undefined, + i.duration = parseFloat(i.duration || 0); i.durationStr = i.duration>0 ? formatSeconds(i.duration) : undefined, totalDuration += i.duration>0 ? i.duration : 0; From 5ce14eab36824632634fdcbf7dd587559bfc215a Mon Sep 17 00:00:00 2001 From: smoothquark Date: Sun, 23 Mar 2025 17:55:45 +0000 Subject: [PATCH 3/3] Allow online albums to show artist names on Line 2 and no. of tracks on Line 4 Currently online albums do not show artist name(s) passed via SlimBrowse Line2 and instead show no. of tracks in Line 2. This commit shows online albums similar to release albums with artist names passed via Line2 in SlimBrowse in Line 2 and no. of tracks (+/- total duration) in Line 4. --- MaterialSkin/HTML/material/html/js/browse-page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MaterialSkin/HTML/material/html/js/browse-page.js b/MaterialSkin/HTML/material/html/js/browse-page.js index 93a779819..10f227a08 100644 --- a/MaterialSkin/HTML/material/html/js/browse-page.js +++ b/MaterialSkin/HTML/material/html/js/browse-page.js @@ -645,7 +645,7 @@ var lmsBrowse = Vue.component("lms-browse", { if (stdItem==STD_ITEM_WORK) { return undefined!=this.current.composer ? this.current.composer : this.current.subtitle; } - if (stdItem==STD_ITEM_ALBUM || stdItem==STD_ITEM_ALL_TRACKS || stdItem==STD_ITEM_COMPOSITION_TRACKS || stdItem==STD_ITEM_MIX || stdItem==STD_ITEM_CLASSICAL_WORKS) { + if (stdItem==STD_ITEM_ALBUM || stdItem==STD_ITEM_ALL_TRACKS || stdItem==STD_ITEM_COMPOSITION_TRACKS || stdItem==STD_ITEM_MIX || stdItem==STD_ITEM_CLASSICAL_WORKS || stdItem==STD_ITEM_ONLINE_ALBUM) { let albumArtst = this.current.subIsYear ? undefined : this.current.subtitle; if (lmsOptions.noArtistFilter && this.current.compilation && this.items.length>0 && undefined!=this.items[0].compilationAlbumArtist) { albumArtst = this.items[0].compilationAlbumArtist; @@ -669,7 +669,7 @@ var lmsBrowse = Vue.component("lms-browse", { return false; } let stdItem = this.current.stdItem ? this.current.stdItem : this.current.altStdItem; - if (stdItem==STD_ITEM_ARTIST || stdItem==STD_ITEM_WORK_COMPOSER || stdItem==STD_ITEM_WORK || stdItem==STD_ITEM_CLASSICAL_WORKS) { + if (stdItem==STD_ITEM_ARTIST || stdItem==STD_ITEM_WORK_COMPOSER || stdItem==STD_ITEM_WORK || stdItem==STD_ITEM_CLASSICAL_WORKS || stdItem==STD_ITEM_ONLINE_ALBUM) { return this.headerSubTitle } if (stdItem==STD_ITEM_ALBUM || stdItem==STD_ITEM_MIX || stdItem==STD_ITEM_ALL_TRACKS || stdItem==STD_ITEM_COMPOSITION_TRACKS) {