Add dumb: a privacy focused genius frontend alternative
This commit is contained in:
1 parent
4b7f1c9c8d
commit
12bc10449e
5 files changed
+155
-46
No files matched your search
@@ -59,8 +59,22 @@ foreach ($overrides as $rule) {
|
||||
}
|
||||
}
|
||||
|
||||
/* -- dumb (Genius-API-free) ------------------------------------------------ */
|
||||
function dumb_artwork($artist, $title) {
|
||||
$path = dumb_search($artist, $title, 5);
|
||||
if ($path === '') return null;
|
||||
$song = dumb_song($path, 5);
|
||||
if ($song === null) return null;
|
||||
|
||||
$art = $song['art'] !== '' ? $song['art'] : $song['song_art'];
|
||||
if ($art === '' && $song['album'] === '') return null;
|
||||
return ['art' => $art, 'album' => $song['album'], 'url' => cfg('dumb.url') . $path];
|
||||
}
|
||||
|
||||
/* -- Genius --------------------------------------------------------------- */
|
||||
function genius_artwork($artist, $title) {
|
||||
if (cfg('dumb.enabled')) return dumb_artwork($artist, $title);
|
||||
|
||||
$token = cfg('genius.token');
|
||||
if ($token === '') return null;
|
||||
$headers = ['Authorization: Bearer ' . $token];
|
||||
|
||||
Reference in new issue
Block a user