if (strtolower($item['name']) === strtolower($artist)) {
if (strtolower($item['name']) === strtolower($artist)) {
array_push($foundArray, $song['id']);
$elem['artist'] = $item['name'];
array_push($artistMatchArray, $elem);
break;
break;
}
}
}
}
}
}
if (count($foundArray) == 0) {
if (count($artistMatchArray) > 0) {
foreach ($songArray as $song) {
$foundArray = $artistMatchArray;
array_push($foundArray, $song["id"]);
}
}
}
// It's not easy for user to select the best match, so randomize the restult so that next time a new one will be returned
// It's not easy for user to select the best match, so randomize the first match so that next time a new one will be returned
shuffle($foundArray);
$info->addTrackInfoToList($artist, $title, "@@@" . $foundArray[rand(0, count($foundArray) - 1)]['id'], "I'm feeling lucky. Random result of the best matches.");