diff options
author | floppydiskette <floppydisk@hyprcat.net> | 2024-12-21 00:21:18 +0000 |
---|---|---|
committer | floppydiskette <floppydisk@hyprcat.net> | 2024-12-21 00:21:18 +0000 |
commit | b65eca420a6bc97d2df8265b40a6da60d2358278 (patch) | |
tree | fd2bc6e1909cba5cdcfef3ae2543420242a18dad /app/Http/Controllers | |
parent | 02e9a6d85d42470682caef299767e03b7b5f53dc (diff) |
Show album cover for current trackv2024.12.20
Diffstat (limited to 'app/Http/Controllers')
-rw-r--r-- | app/Http/Controllers/MusicController.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/Http/Controllers/MusicController.php b/app/Http/Controllers/MusicController.php index 5e31d86..08a01f6 100644 --- a/app/Http/Controllers/MusicController.php +++ b/app/Http/Controllers/MusicController.php @@ -25,10 +25,12 @@ class MusicController extends Controller $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; |