evaluate("//script[@data-tralbum]")->item(0)->getAttribute("data-tralbum")); $additional = json_decode($document->evaluate("//script[@type=\"application/ld+json\"]")->item(0)->textContent); if ($json) $title = $json->current->title; ?> "; echo htmlspecialchars($json->current->title) . " "; $album = $document->evaluate("//span[@class=\"fromAlbum\"]")->item(0); if ($album) { echo "from parentElement->getAttribute("href"), "artist")) . "\">"; echo htmlspecialchars($album->textContent); echo " "; }; echo "by " . htmlspecialchars($json->artist) . ""; echo ""; echo "
"; if (isset($json->art_id)) $image = "https://f4.bcbits.com/img/" . $json->art_id . "_4.jpg"; else $image = null; $about = $json->current->about; if (property_exists($additional, "inAlbum")) { $description = $additional->inAlbum->albumRelease[0]->additionalProperty; if ($description) $description = current(array_filter($description, fn($property) => $property->name === 'digital_release_description')); if ($description) $description = $description->value; }; $text = $about ?? $description ?? null; echo_sidebar($image, $text); echo "
"; if (count($json->trackinfo)) { echo ""; echo "Tracklist"; echo ""; foreach ($json->trackinfo as $track) { $link = $track->title_link; if ($link) { $link = prefix_link($link, "artist"); $link = convert_bandcamp_link($link); }; $duration = round($track->duration); if ($duration) $duration = floor($duration / 60) . ":" . sprintf("%02d", $duration % 60); else $duration = null; echo ""; echo ""; echo ""; echo ""; echo ""; if ($track->file) { $file = $track->file; $file = get_mangled_object_vars($file); $file = end($file); echo ""; echo ""; echo ""; echo ""; }; }; echo "
" . ($track->track_num ?? 1) . "."; if ($link) echo ""; echo htmlspecialchars($track->title); if ($link) echo ""; echo "" . $duration . "
"; echo ""; echo "
"; echo ""; }; $videos = array_filter($json->trackinfo, fn($track) => $track->video_mobile_url); if ($videos) { echo ""; echo "Videos"; foreach ($videos as $video) { $src = convert_bandcamp_link("https://bandcamp.23video.com" . $video->video_mobile_url); $poster = convert_bandcamp_link("https://bandcamp.23video.com/" . $video->video_poster_url); echo ""; }; echo ""; }; if (property_exists($json->current, "lyrics")) $lyrics = $json->current->lyrics; if (isset($lyrics)) { echo ""; echo "Lyrics"; echo "

" . nl2br(htmlspecialchars($lyrics)) . "

"; echo ""; }; echo ""; echo "Credits"; $credits = $document->evaluate("//div[contains(@class, \"tralbum-credits\")]")->item(0); $from = $document->evaluate("./a[@href]", $credits)->item(0); if ($from) $from->removeAttribute("href"); echo $document->document->saveHTML($credits); echo ""; if (property_exists($additional, "copyrightNotice")) { echo ""; echo "License"; if ($additional->copyrightNotice === "All Rights Reserved") { echo "All rights reserved."; } elseif ($additional->copyrightNotice === "Various") { echo "License varies by track. See the invidual track pages for details."; } else { $license = str_replace( ["Attribution", "No-Derivatives", "Non-Commercial", "Share-Alike"], ["BY", "ND", "NC", "SA"], str_replace(" ", "-", $additional->copyrightNotice) ); echo "CC " . $license . " 3.0. "; echo ""; echo "See the Creative Commons website for details."; echo ""; }; echo ""; }; $tags = $additional->keywords; echo ""; echo "Tags"; echo ""; echo ""; $recommendations = $document->evaluate("//li[contains(@class, \"recommended-album\")]"); if ($recommendations->count()) { echo ""; echo "Recommendations"; echo "
"; foreach ($recommendations as $recommendation) { $link = convert_bandcamp_link($document->evaluate(".//a[@class=\"album-link\"]", $recommendation)->item(0)->getAttribute("href")); $image = convert_bandcamp_link(resize_link($document->evaluate(".//img", $recommendation)->item(0)->getAttribute("src"), 3)); $text = $recommendation->getAttribute("data-albumtitle"); $description = "by " . $recommendation->getAttribute("data-artist"); echo_item($link, $image, $text, $description); }; echo "
"; echo ""; }; echo "
"; if (isset($additional->publisher->image)) { $image = $additional->publisher->image; $image = resize_link($image, 4); } else $image = null; if (isset($additional->publisher->description)) $text = $additional->publisher->description; else $text = null; $links = $document->evaluate("//ol[@id=\"band-links\"]//a"); echo_sidebar($image, $text, $links); echo "
"; } else { echo_error_message(); }; ?>