blob: 0fbcda2acaa602b73f2fb63c9806590a5902b96a (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
|
@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'];
$api_alive = true;
try {
$data = file_get_contents($api_root.'/lastfm/current');
} catch (Exception $e) {
$api_alive = false;
}
@endphp
@if (!$api_alive)
@include('components.errors.api-error')
@else
@php
$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="info-table" role="presentation" width="100%">
<tr>
<td colspan="4">
<h2>Last/Current Track:</h2>
</td>
</tr>
<tr>
<td colspan="4">
<a href="{{ $current_track->url }}">{{ $current_track->title }} • {{ $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 style="white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:1px;" width="50%">{{ $track->title }}</td>
<td style="white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:1px;" width="50%">{{ $track->artist }}</td>
<td>{{ $track->playcount }}</td>
</tr>
@endforeach
</table>
@endif
@stop
|