2023-06-14 21:05:01 +00:00
|
|
|
@php
|
2023-06-13 22:07:20 +00:00
|
|
|
|
2023-06-14 21:05:01 +00:00
|
|
|
$cfg = app('config')->get('services')['lastfm'];
|
2023-07-02 01:01:54 +00:00
|
|
|
$api_root = app('config')->get('app')['api_root'];
|
2023-06-13 22:07:20 +00:00
|
|
|
|
2023-07-02 01:01:54 +00:00
|
|
|
$current_track = json_decode(file_get_contents($api_root.'/lastfm/current'));
|
|
|
|
$toptracks = json_decode(file_get_contents($api_root.'/lastfm/top'));
|
2023-06-13 22:07:20 +00:00
|
|
|
$count = 0;
|
2023-06-14 21:05:01 +00:00
|
|
|
@endphp
|
2023-06-13 22:07:20 +00:00
|
|
|
|
|
|
|
<h1>Last.fm <small>(<a href="https://www.last.fm/user/{{ $cfg['user']}}">Profile</a>)</small></h1>
|
2023-07-02 01:01:54 +00:00
|
|
|
<b>Last/Current Track:</b> <a href="{{ $current_track->url }}">{{ $current_track->name }} • {{ $current_track->artist }}</a>
|
2023-06-14 21:05:01 +00:00
|
|
|
<h2>Top {{ $cfg['toptracks'] }} Tracks (Last 7 days)</h2>
|
2023-06-13 22:07:20 +00:00
|
|
|
<ol>
|
2023-07-02 01:01:54 +00:00
|
|
|
@foreach ($toptracks as $track)
|
2023-06-14 21:05:01 +00:00
|
|
|
@if ($count >= $cfg['toptracks'])
|
2023-06-13 22:07:20 +00:00
|
|
|
</ol>
|
|
|
|
@break
|
|
|
|
@endif
|
|
|
|
<li>
|
2023-07-02 01:01:54 +00:00
|
|
|
<a href="{{ $track->url }}">{{ $track->name }} • {{ $track->artist }}</a>
|
|
|
|
<small>({{ $track->plays }} plays)</small>
|
2023-06-13 22:07:20 +00:00
|
|
|
</li>
|
2023-06-14 21:05:01 +00:00
|
|
|
@php $count++ @endphp
|
2023-06-13 22:07:20 +00:00
|
|
|
@endforeach
|