diff options
author | Frankie B <git@diskfloppy.me> | 2023-07-28 23:42:17 +0100 |
---|---|---|
committer | Frankie B <frankieraybrown@gmail.com> | 2023-07-29 18:10:50 +0100 |
commit | a7b369d9886a547075058f7ada231b14badaf059 (patch) | |
tree | 619e2668a57736951a51808d73c5dee5688b4b9c /resources/views | |
parent | a3c787e1f6d26d7f18a610c66fd908e7b0a1ca87 (diff) |
Add music page
Diffstat (limited to 'resources/views')
-rw-r--r-- | resources/views/pages/music.blade.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/resources/views/pages/music.blade.php b/resources/views/pages/music.blade.php new file mode 100644 index 0000000..cba45c2 --- /dev/null +++ b/resources/views/pages/music.blade.php @@ -0,0 +1,55 @@ +@extends('layouts.default') +@section('title', 'Music') +@section('description', '') +@section('content') + @php + + $cfg = app('config')->get('services')['lastfm']; + $api_root = app('config')->get('app')['api_root']; + + $current_track = json_decode(file_get_contents($api_root . '/lastfm/current')); + $toptracks = json_decode(file_get_contents($api_root . '/lastfm/top')); + $count = 0; + @endphp + <table class="infotable"> + <tr> + <td colspan="4"> + <h2>Last/Current Track:</h2> + </td> + </tr> + <tr> + <td colspan="4"> + <a href="{{ $current_track->url }}">{{ $current_track->name }} • {{ $current_track->artist }}</a><br> + </td> + </tr> + <tr> + <td colspan="4"> + <hr> + </td> + </tr> + <tr> + <td colspan="4"> + <h2>Top {{ $cfg['toptracks'] }} Tracks (Last 7 days)</h2> + </td> + </tr> + <tr"> + <td style="text-align: right"><b>#</b></td> + <td><b>Track</b></td> + <td><b>Artist</b></td> + <td><b>Plays</b></td> + </tr> + @foreach ($toptracks as $track) + @php $count++ @endphp + @if ($count >= $cfg['toptracks']) + @break + @endif + <tr> + <td style="text-align: right">{{ $count+1 }}</td> + <td>{{ $track->name }}</td> + <td>{{ $track->artist }}</td> + <td>{{ $track->plays }}</td> + </tr> + @endforeach + </table> + <hr> +@stop |