From 6ab627ba601a27d2633a09d1f6dd6489cd375108 Mon Sep 17 00:00:00 2001 From: iamdoubz Date: Tue, 15 Apr 2025 14:29:39 -0500 Subject: [PATCH] Add custom artwork section --- title.php | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/title.php b/title.php index 20af10a..947b614 100644 --- a/title.php +++ b/title.php @@ -30,6 +30,7 @@ $bearer = base64_decode($genius); // Default variables $random_number = rand(0, 100); +$d = '|,='; $art = ''; $title = ''; $ftitle = ''; @@ -45,6 +46,33 @@ if ($vartist === 'n' && $vtitle === 'n'){ echo "offline|,=offline|,=offline|,=offline|,=offline|,=offline"; exit(0); } + +// Replace artwork based on artist and song title +function customArt($artist, $title){ + $customArt = array( + //array("Artist", "Song", "Art URL"), + array("BAW", "CHILDHOOD MEMORIES", "https://i1.sndcdn.com/artworks-zNyvrtxKfGAu60Yr-e7fGPA-t500x500.jpg"), + array("BAW", "happy (fracture)", "https://i1.sndcdn.com/artworks-KzJr6d6rIpSZFYM3-enWyJQ-t500x500.jpg"), + array("BAW", "RO t TEN", "https://i1.sndcdn.com/artworks-zXM1fWSPPcKdTBzy-8NpODA-t500x500.jpg"), + array("Steve Reich", "", "https://stevereich.com/wp-content/uploads/Steve-Reich-J.Herman-e1654903069903-400x340.jpeg") + ); + if (array_search($artist, array_column($customArt, 0)) !== false && array_search($title, array_column($customArt, 1)) !== false) { + $ca = array_search($title, array_column($customArt, 1)); + return $customArt[$ca][2]; + } elseif (array_search($artist, array_column($customArt, 0)) !== false) { + $ca = array_search($artist, array_column($customArt, 0)); + return $customArt[$ca][2]; + } else { + return "no"; + } +} + +$custom_artwork = customArt($vartist, $vtitle); +if ($custom_artwork !== 'no'){ + echo $custom_artwork . $d . $vtitle . $d . $vtitle . $d . $lyrics . $d . $scrapeme . $d . $album; + exit(0); +} + $json = rawurlencode($vartist . ' - ' . $vtitle); // Curl function @@ -115,8 +143,6 @@ function badArt($arturl){ $art = badArt($art); -if ($vartist === 'BAW' && $vtitle === 'CHILDHOOD MEMORIES'){$art = "https://i1.sndcdn.com/artworks-zNyvrtxKfGAu60Yr-e7fGPA-t500x500.jpg";} - // If routine couldn't find anything, return "unknown" if (!$title){$title = $vtitle;} if (!$ftitle){$ftitle = "unknown";} @@ -125,4 +151,4 @@ if (!$scrapeme){$scrapeme = "unknown";} if(!$album){$album = "unknown";} // Return data separated with delimeter "|,=" -echo "$art|,=$title|,=$ftitle|,=$lyrics|,=$scrapeme|,=$album"; +echo "$art|,=$title|,=$ftitle|,=$lyrics|,=$scrapeme|,=$album"; \ No newline at end of file