Show album cover for current track
This commit is contained in:
parent
02e9a6d85d
commit
b65eca420a
4 changed files with 23 additions and 3 deletions
|
@ -25,10 +25,12 @@ public function getCurrentTrack() {
|
|||
$data = $response->json();
|
||||
error_log($response->body());
|
||||
$track_data = $data["recenttracks"]["track"][0];
|
||||
$image = array_column($track_data["image"], null, 'size')['large'] ?? false;
|
||||
$current_track = [
|
||||
'title' => $track_data["name"],
|
||||
'artist' => $track_data["artist"]["#text"],
|
||||
'url' => $track_data["url"],
|
||||
'image' => $image["#text"],
|
||||
];
|
||||
Cache::put('current_track', $current_track, now()->addSeconds(15));
|
||||
return $current_track;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue