« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/track.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/track.js')
-rw-r--r--src/data/things/track.js32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index a0a4ff41..98a9fdd1 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -376,15 +376,35 @@ export class Track extends Thing {
   [inspect.custom]() {
     const base = Thing.prototype[inspect.custom].apply(this);
 
+    const rereleasePart =
+      (this.originalReleaseTrackByRef
+        ? `${color.yellow('[rerelease]')} `
+        : ``);
+
     const {album, dataSourceAlbum} = this;
-    const albumName = album ? album.name : dataSourceAlbum?.name;
+
+    const albumName =
+      (album
+        ? album.name
+        : dataSourceAlbum?.name);
+
     const albumIndex =
       albumName &&
-      (album ? album.tracks.indexOf(this) : dataSourceAlbum.tracks.indexOf(this));
-    const trackNum = albumIndex === -1 ? '#?' : `#${albumIndex + 1}`;
+        (album
+          ? album.tracks.indexOf(this)
+          : dataSourceAlbum.tracks.indexOf(this));
+
+    const trackNum =
+      albumName &&
+        (albumIndex === -1
+          ? '#?'
+          : `#${albumIndex + 1}`);
+
+    const albumPart =
+      albumName
+        ? ` (${color.yellow(trackNum)} in ${color.green(albumName)})`
+        : ``;
 
-    return albumName
-      ? base + ` (${color.yellow(trackNum)} in ${color.green(albumName)})`
-      : base;
+    return rereleasePart + base + albumPart;
   }
 }