diff --git a/app/Http/Controllers/MusicController.php b/app/Http/Controllers/MusicController.php index 08a01f6..8683d86 100644 --- a/app/Http/Controllers/MusicController.php +++ b/app/Http/Controllers/MusicController.php @@ -26,11 +26,16 @@ public function getCurrentTrack() { error_log($response->body()); $track_data = $data["recenttracks"]["track"][0]; $image = array_column($track_data["image"], null, 'size')['large'] ?? false; + $now_playing = false; + if (array_key_exists("@attr", $track_data)) { + $now_playing = $track_data["@attr"]["nowplaying"] == "true" ?? false; + } $current_track = [ 'title' => $track_data["name"], 'artist' => $track_data["artist"]["#text"], 'url' => $track_data["url"], 'image' => $image["#text"], + 'header' => $now_playing ? "Now Playing" : "Last Track", ]; Cache::put('current_track', $current_track, now()->addSeconds(15)); return $current_track; diff --git a/config/app.php b/config/app.php index 5386866..7a3c2bb 100644 --- a/config/app.php +++ b/config/app.php @@ -5,7 +5,7 @@ return [ 'name' => env('APP_NAME', 'diskfloppy.me'), - 'version' => '2024.12.21', + 'version' => '2024.12.25', 'env' => env('APP_ENV', 'production'), 'debug' => (bool) env('APP_DEBUG', false), 'url' => env('APP_URL', 'http://localhost'), diff --git a/resources/views/components/current-track.blade.php b/resources/views/components/current-track.blade.php index 45479d8..d5777cb 100644 --- a/resources/views/components/current-track.blade.php +++ b/resources/views/components/current-track.blade.php @@ -3,7 +3,8 @@ Album cover for {{ $track[
-

Last/Current Track:

- {{ $track["title"] }} • {{ $track["artist"] }}
+

{{ $track["header"] }}:

+ {{ $track["title"] }}
+ by {{ $track["artist"] }}