wah.moe/resources/views/pages/music.blade.php

55 lines
1.6 KiB
PHP
Raw Normal View History

2023-07-28 22:42:17 +00:00
@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'));
2023-08-14 22:45:31 +00:00
$top_tracks = json_decode(file_get_contents($api_root . '/lastfm/top'));
2023-07-28 22:42:17 +00:00
$count = 0;
@endphp
2023-08-16 13:10:19 +00:00
<table class="info-table">
2023-07-28 22:42:17 +00:00
<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>
2023-08-16 13:10:19 +00:00
<tr>
2023-08-14 22:45:31 +00:00
<td style="text-align: right"><b>#</b></td>
<td><b>Track</b></td>
<td><b>Artist</b></td>
<td><b>Plays</b></td>
2023-07-28 22:42:17 +00:00
</tr>
2023-08-14 22:45:31 +00:00
@foreach ($top_tracks as $track)
2023-07-28 22:42:17 +00:00
@php $count++ @endphp
2023-08-14 22:45:31 +00:00
@if ($count >= $cfg['toptracks']+1)
2023-07-28 22:42:17 +00:00
@break
@endif
<tr>
2023-08-14 22:45:31 +00:00
<td style="text-align: right">{{ $count }}</td>
2023-07-28 22:42:17 +00:00
<td>{{ $track->name }}</td>
<td>{{ $track->artist }}</td>
<td>{{ $track->plays }}</td>
</tr>
@endforeach
</table>
@stop