aboutsummaryrefslogtreecommitdiff
path: root/resources/views/pages/music.blade.php
blob: e24f88cf76ae7504634d6d9604c590ff1f82e5e2 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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'));
        $top_tracks = 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 ($top_tracks as $track)
            @php $count++ @endphp
            @if ($count >= $cfg['toptracks']+1)
                @break
            @endif
            <tr>
                <td style="text-align: right">{{ $count }}</td>
                <td>{{ $track->name }}</td>
                <td>{{ $track->artist }}</td>
                <td>{{ $track->plays }}</td>
            </tr>
        @endforeach
    </table>
@stop