coryd.dev/src/pages/dynamic/media/music/index.php.liquid

77 lines
2.4 KiB
Text

---
title: Music
description: This is everything I've been listening to recently — it's collected in a database as I listen to it and displayed here.
permalink: "/music/index.php"
schema: music-index
eleventyComputed:
page:
activeUrl: "/music"
---
<?php
require_once __DIR__ . '/../../vendor/autoload.php';
require_once __DIR__ . "/../config/dynamic/init.php";
use App\Classes\MusicDataHandler;
$handler = new MusicDataHandler();
$music = $handler->getThisWeekData();
?>
<h2 class="page-title">{{ title }}</h2>
<p>I've listened to <mark><?= number_format($music['total_artists']) ?> artists</mark>, <mark><?= number_format($music['total_albums']) ?> albums</mark> and <mark><?= number_format($music['total_tracks']) ?> tracks</mark> this week. Most of that has been <?= renderMediaLinks($music['week_genres'], 'genre', 5) ?>.</p>
<p><mark>Take a look at what I've listened to</mark> <a href="/music/this-month">this month</a> or <a href="/music/concerts" class="concerts">check out the concerts I've been to</a>.</p>
{% render "dynamic/media/now-playing.php.liquid" %}
<hr />
<?php if (!empty($music['week_artists'])): ?>
<h3 id="artists">
<a href="/music/this-week/artists">
{% tablericon "microphone-2" %} Artists
</a>
</h3>
<?php echo renderMediaGrid($music['week_artists'], 8, 'eager'); ?>
<?php endif; ?>
{% render "static/media/music/tables/all-time/artists.liquid",
globals:globals,
topArtists:topArtists
%}
<?php if (!empty($music['week_albums'])): ?>
<h3 id="albums">
<a href="/music/this-week/albums">
{% tablericon "vinyl" %} Albums
</a>
</h3>
<?php echo renderMediaGrid($music['week_albums'], 8, 'eager'); ?>
<?php endif; ?>
{% render "static/media/music/tables/all-time/albums.liquid",
globals:globals,
topAlbums:topAlbums
%}
<h3 id="tracks">
<a href="/music/this-week/tracks/">
{% tablericon "playlist" %}
Tracks
</a>
</h3>
<details open>
<summary>Recent</summary>
{% render "dynamic/media/recent-tracks.php.liquid" %}
</details>
<details>
<summary>This week</summary>
{% render "static/media/music/charts/rank.liquid",
data:music.week.tracks,
count:10
%}
</details>
{%- if albumReleases.upcoming.size > 0 -%}
<h3 id="album-releases">
<a href="/music/album-releases/">
{% tablericon "calendar-time" %}
Anticipated albums
</a>
</h3>
{% render "static/media/grid.liquid",
globals:globals,
data:albumReleases.upcoming,
count:8
%}
{%- endif -%}