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();
|
$data = $response->json();
|
||||||
error_log($response->body());
|
error_log($response->body());
|
||||||
$track_data = $data["recenttracks"]["track"][0];
|
$track_data = $data["recenttracks"]["track"][0];
|
||||||
|
$image = array_column($track_data["image"], null, 'size')['large'] ?? false;
|
||||||
$current_track = [
|
$current_track = [
|
||||||
'title' => $track_data["name"],
|
'title' => $track_data["name"],
|
||||||
'artist' => $track_data["artist"]["#text"],
|
'artist' => $track_data["artist"]["#text"],
|
||||||
'url' => $track_data["url"],
|
'url' => $track_data["url"],
|
||||||
|
'image' => $image["#text"],
|
||||||
];
|
];
|
||||||
Cache::put('current_track', $current_track, now()->addSeconds(15));
|
Cache::put('current_track', $current_track, now()->addSeconds(15));
|
||||||
return $current_track;
|
return $current_track;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => env('APP_NAME', 'diskfloppy.me'),
|
'name' => env('APP_NAME', 'diskfloppy.me'),
|
||||||
'version' => '2024.12.19',
|
'version' => '2024.12.20',
|
||||||
'env' => env('APP_ENV', 'production'),
|
'env' => env('APP_ENV', 'production'),
|
||||||
'debug' => (bool) env('APP_DEBUG', false),
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
|
@ -252,6 +252,19 @@ table.music-top10 tr td:first-child {
|
||||||
background-color: var(--table-header);
|
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 **/
|
/** Bookmarks **/
|
||||||
div.bookmark-category:first-child h2 {
|
div.bookmark-category:first-child h2 {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="current-track">
|
<div class="current-track">
|
||||||
<h2>Last/Current Track:</h2>
|
<div>
|
||||||
<a href="{{ $track["url"] }}">{{ $track["title"] }} • {{ $track["artist"] }}</a><br>
|
<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>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue