aboutsummaryrefslogtreecommitdiff
path: root/resources/views/components/lastfm.blade.php
blob: 75ec0642e0f05281007f762abf2e9e2bf3b68f96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@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

<h1>Last.fm <small>(<a href="https://www.last.fm/user/{{ $cfg['user']}}">Profile</a>)</small></h1>
        <b>Last/Current Track:</b> <a href="{{ $current_track->url }}">{{ $current_track->name }}  {{ $current_track->artist }}</a>
        <h2>Top {{ $cfg['toptracks'] }} Tracks (Last 7 days)</h2>
        <ol>
@foreach ($toptracks as $track)
    @if ($count >= $cfg['toptracks'])
    </ol>
        @break
    @endif
        <li>
                <a href="{{ $track->url }}">{{ $track->name }}  {{ $track->artist }}</a>
                <small>({{ $track->plays }} plays)</small>
            </li>
@php $count++ @endphp
@endforeach