fix: upcoming albums

This commit is contained in:
Cory Dransfeldt 2024-07-10 09:25:29 -07:00
parent 8fd2e34341
commit 7aada933da
No known key found for this signature in database
3 changed files with 8 additions and 9 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "coryd.dev",
"version": "20.0.1",
"version": "20.0.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "coryd.dev",
"version": "20.0.1",
"version": "20.0.2",
"license": "MIT",
"dependencies": {
"@cdransf/api-text": "^1.4.0",

View file

@ -1,6 +1,6 @@
{
"name": "coryd.dev",
"version": "20.0.1",
"version": "20.0.2",
"description": "The source for my personal site. Built using 11ty.",
"type": "module",
"scripts": {

View file

@ -13,11 +13,11 @@ export default async function () {
.select(`
name,
key,
image,
release_date,
release_link,
total_plays,
artists (name_string, mbid, country)
art(filename_disk),
artists(name_string, mbid, country)
`)
.gt('release_date', today)
@ -26,17 +26,16 @@ export default async function () {
return
}
return data.filter(album => !album['total_plays'] || !album['total_plays'] > 0).map(album => {
return {
return data.filter(album => !album['total_plays'] || !album['total_plays'] > 0).map(album => ({
artist: album['artists']['name_string'],
title: album['name'],
date: DateTime.fromISO(album['release_date']).toLocaleString(DateTime.DATE_FULL),
url: album['release_link'],
image: album['image'],
image: `/${album?.['art']?.['filename_disk']}` || '',
artist_url: `/music/artists/${sanitizeMediaString(album['artists']['name_string'])}-${sanitizeMediaString(parseCountryField(album['artists']['country']))}`,
mbid: album['artists']['mbid'],
timestamp: DateTime.fromISO(album['release_date']).toSeconds(),
type: 'album-release'
}
}).sort((a, b) => a.timestamp - b.timestamp)
)).sort((a, b) => a.timestamp - b.timestamp)
}