feat: upcoming albums on now page

This commit is contained in:
Cory Dransfeldt 2023-06-08 14:08:19 -07:00
parent bca69910e5
commit 4faf9f8b53
No known key found for this signature in database
5 changed files with 54 additions and 13 deletions

1
.env
View file

@ -2,3 +2,4 @@ API_KEY_LASTFM=
API_KEY_TRAKT= API_KEY_TRAKT=
API_KEY_WEBMENTIONS_CORYD_DEV= API_KEY_WEBMENTIONS_CORYD_DEV=
SECRET_FEED_INSTAPAPER_FAVORITES= SECRET_FEED_INSTAPAPER_FAVORITES=
SECRET_FEED_ALBUM_RELEASES=

View file

@ -48,6 +48,7 @@
"eleventy-plugin-youtube-embed": "^1.9.0", "eleventy-plugin-youtube-embed": "^1.9.0",
"eslint-plugin-jsx-a11y": "^6.7.1", "eslint-plugin-jsx-a11y": "^6.7.1",
"husky": "^8.0.3", "husky": "^8.0.3",
"ics-to-json-extended": "^1.1.4",
"lint-staged": "^13.2.2", "lint-staged": "^13.2.2",
"liquidjs": "^10.8.2", "liquidjs": "^10.8.2",
"luxon": "^3.3.0", "luxon": "^3.3.0",

View file

@ -0,0 +1,14 @@
const { AssetCache } = require('@11ty/eleventy-fetch')
const ics = require('ics-to-json-extended')
const { DateTime } = require('luxon')
module.exports = async function () {
const URL = process.env.SECRET_FEED_ALBUM_RELEASES
const icsToJson = ics.default
const asset = new AssetCache('album_release_data')
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
const icsRes = await fetch(URL)
const icsData = await icsRes.text()
const data = icsToJson(icsData)
return data.filter((d) => DateTime.fromISO(d.startDate) > DateTime.now())
}

View file

@ -2,7 +2,7 @@
layout: main layout: main
--- ---
{% include "header.liquid" %} {% include "header.liquid" %}
<div class="pt-12 prose dark:prose-invert hover:prose-a:text-blue-500 max-w-full"> <ul class="pt-12 prose dark:prose-invert hover:prose-a:text-blue-500 max-w-full">
<h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4"> <h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4">
{% heroicon "solid" "clock" "Currently" "height=28" %} {% heroicon "solid" "clock" "Currently" "height=28" %}
<div class="ml-1">Currently</div> <div class="ml-1">Currently</div>
@ -89,6 +89,21 @@ layout: main
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
{% if albumReleases.size > 0 %}
<h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4">
{% heroicon "solid" "calendar" "Albums I'm looking forward to" "height=28" %}
<div class="ml-1">Albums I'm looking forward to</div>
</h2>
<ul class="list-inside list-disc pl-5 md:pl-10">
{% for album in albumReleases %}
<li class="mt-1.5 mb-2">
<a href="https://{{album.location}}" title="{{album.summary | escape}}">
{{ album.startDate | date: "%m.%d.%Y" }}: {{album.summary}}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% if books.size > 0 %} {% if books.size > 0 %}
<h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4"> <h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4">
{% heroicon "solid" "bookmark" "Books" "height=28" %} {% heroicon "solid" "bookmark" "Books" "height=28" %}
@ -115,17 +130,15 @@ layout: main
{% heroicon "solid" "newspaper" "Links" "height=28" %} {% heroicon "solid" "newspaper" "Links" "height=28" %}
<div class="ml-1">Links</div> <div class="ml-1">Links</div>
</h2> </h2>
<div> <ul class="list-inside list-disc pl-5 md:pl-10">
<ul class="list-inside list-disc pl-5 md:pl-10"> {% for link in links %}
{% for link in links %} <li class="mt-1.5 mb-2">
<li class="mt-1.5 mb-2"> <a href="{{link.link}}" title="{{link.title | escape}}">
<a href="{{link.link}}" title="{{link.title | escape}}"> {{ link.title }}
{{ link.title }} </a>
</a> </li>
</li> {% endfor %}
{% endfor %} </ul>
</ul>
</div>
{% endif %} {% endif %}
{% if movies.size > 0 %} {% if movies.size > 0 %}
<h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4"> <h2 class="m-0 text-xl flex flex-row items-center font-black leading-tight tracking-normal dark:text-gray-200 md:text-2xl mt-8 mb-4">

View file

@ -2843,6 +2843,13 @@ iconv-lite@0.4.24:
dependencies: dependencies:
safer-buffer ">= 2.1.2 < 3" safer-buffer ">= 2.1.2 < 3"
ics-to-json-extended@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/ics-to-json-extended/-/ics-to-json-extended-1.1.4.tgz#38e65b574c8175a6d2dd4b950a70789f6bbe174a"
integrity sha512-5NtUG7GwN2uVp4Gg1++brlELbv/fkIU+N7rZGQCIKujQAf+l6LTjMjsNifma3bX2CrPcsxy2tf/9bqF/NWIDWA==
dependencies:
moment "^2.29.1"
ieee754@^1.1.13: ieee754@^1.1.13:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
@ -3834,6 +3841,11 @@ mkdirp@^0.5.1:
dependencies: dependencies:
minimist "^1.2.6" minimist "^1.2.6"
moment@^2.29.1:
version "2.29.4"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
moo@^0.5.1, moo@^0.5.2: moo@^0.5.1, moo@^0.5.2:
version "0.5.2" version "0.5.2"
resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.2.tgz#f9fe82473bc7c184b0d32e2215d3f6e67278733c" resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.2.tgz#f9fe82473bc7c184b0d32e2215d3f6e67278733c"