Browse Source

Handle unreleased tracks

See `release.php?type=album&artist=youthlagoon&name=heaven-is-a-junkyard` for an example.
Sunny 2 years ago
parent
commit
9ff845fb71
1 changed files with 13 additions and 4 deletions
  1. 13 4
      pages/release.php

+ 13 - 4
pages/release.php

@@ -45,15 +45,24 @@
 
     foreach ($json->trackinfo as $track) {
       $link = $track->title_link;
-      $link = prefix_link($link, "artist");
-      $link = convert_link($link);
+      if ($link) {
+        $link = prefix_link($link, "artist");
+        $link = convert_link($link);
+      };
 
       $duration = round($track->duration);
-      $duration = floor($duration / 60) . ":" . sprintf("%02d", $duration % 60);
+      if ($duration)
+        $duration = floor($duration / 60) . ":" . sprintf("%02d", $duration % 60);
+      else
+        $duration = null;
 
       echo "<tr>";
       echo "<td>" . ($track->track_num ?? 1) . ".</td>";
-      echo "<td><a href=\"" . $link . "\">" . $track->title . "</a></td>";
+      echo "<td>";
+      if ($link) echo "<a href=\"" . $link . "\">";
+      echo $track->title;
+      if ($link) echo "</a>";
+      echo "</td>";
       echo "<td>" . $duration . "</td>";
       echo "</tr>";