Add custom artwork section

This commit is contained in:
iamdoubz committed 2025-04-15 14:29:39 -05:00
1 parent 2a6b27ce3f
commit 6ab627ba60
1 file changed
+29 -3
+29 -3
View File
@@ -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";