« get me outta code hell

search, client: refactor & simplify search result image processing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-13 09:02:54 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-31 12:11:52 -0300
commit1b399c2451b222597bf734dbf8a211e8b421fe07 (patch)
tree8e5d3fcbf5c3a517c53bd82f5ef7af6f339409d1 /src/static/js/client.js
parent5038549631b0413552fe6589e7c77f66e53e7bcd (diff)
search, client: refactor & simplify search result image processing
Diffstat (limited to 'src/static/js/client.js')
-rw-r--r--src/static/js/client.js32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js
index 771d2011..bee82938 100644
--- a/src/static/js/client.js
+++ b/src/static/js/client.js
@@ -3862,36 +3862,12 @@ function generateSidebarSearchResult(result) {
 
 function getSearchResultImageSource(result) {
   const {artwork} = result.data;
-
   if (!artwork) return null;
 
-  const [kind, ...opts] = artwork;
-
-  switch (kind) {
-    case 'flash':
-      return rebase(
-        ('flash-art'
-       + `/${result.directory}.small.jpg`),
-        'rebaseThumb');
-
-    case 'track':
-      return rebase(
-        (`album-art`
-       + `/${opts[0]}`
-       + `/${result.directory}`
-       + `.small.jpg`),
-        'rebaseThumb');
-
-    case 'track-album':
-      return rebase(
-         (`album-art`
-        + `/${opts[0]}`
-        + `/cover.small.jpg`),
-        'rebaseThumb');
-
-    default:
-      return null;
-  }
+  return (
+    rebase(
+      artwork.replace('<>', result.directory),
+      'rebaseThumb'));
 }
 
 function generateSidebarSearchResultTemplate(slots) {