Show album cover for current track
This commit is contained in:
parent
48d3ad22d3
commit
70ac42f2f5
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;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
return [
|
||||
'name' => env('APP_NAME', 'diskfloppy.me'),
|
||||
'version' => '2024.12.19',
|
||||
'version' => '2024.12.20',
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
|
|
@ -252,6 +252,19 @@ table.music-top10 tr td:first-child {
|
|||
background-color: var(--table-header);
|
||||
}
|
||||
|
||||
div.current-track {
|
||||
display: grid;
|
||||
grid-template-columns: 180px auto;
|
||||
grid-template-rows: 1fr;
|
||||
grid-column-gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
div.current-track img {
|
||||
float: left;
|
||||
filter: var(--shadow-small);
|
||||
border: var(--border);
|
||||
}
|
||||
|
||||
/** Bookmarks **/
|
||||
div.bookmark-category:first-child h2 {
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<div class="current-track">
|
||||
<h2>Last/Current Track:</h2>
|
||||
<a href="{{ $track["url"] }}">{{ $track["title"] }} • {{ $track["artist"] }}</a><br>
|
||||
<div>
|
||||
<img src="{{ $track["image"] }}" alt="Album cover for {{ $track["title"] }} by {{ $track["artist"] }}">
|
||||
</div>
|
||||
<div>
|
||||
<h2>Last/Current Track:</h2>
|
||||
<a href="{{ $track["url"] }}">{{ $track["title"] }} • {{ $track["artist"] }}</a><br>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue