@php $cfg = app('config')->get('services')['lastfm']; $current_response = json_decode(file_get_contents("https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=".$cfg['user']."&nowplaying=true&format=json&api_key=".$cfg['key'])); $nowplaying = $current_response->recenttracks->track[0]; $toptracks = json_decode(file_get_contents("https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=".$cfg['user']."&format=json&period=7day&api_key=".$cfg['key'])); $tracks = $toptracks->toptracks->track; $count = 0; @endphp

Last.fm (Profile)

Last/Current Track: {{ $nowplaying->name }} • {{ $nowplaying->artist->{"#text"} }}

Top {{ $cfg['toptracks'] }} Tracks (Last 7 days)

    @foreach ($tracks as $track) @if ($count >= $cfg['toptracks'])
@break @endif
  • {{ $track->name }} • {{ $track->artist->name }} ({{ $track->playcount }} plays)
  • @php $count++ @endphp @endforeach