diff --git a/.env b/.env index bfaf6f11..ed5d6af4 100644 --- a/.env +++ b/.env @@ -4,5 +4,4 @@ SITE_KEY_CLICKY= API_KEY_TRAKT= API_KEY_MOVIEDB= SECRET_FEED_ALBUM_RELEASES= -COOKIE_STORYGRAPH= ACCOUNT_ID_PLEX= \ No newline at end of file diff --git a/config/filters/index.js b/config/filters/index.js index 11cb3561..5cf27128 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -166,6 +166,7 @@ export default { let normalized = { image: item['image'], url: item['url'], + type: item.type } if (item.type === 'album') { normalized['title'] = item['title'] @@ -196,6 +197,7 @@ export default { return normalized }), calculatePlayPercentage: (plays, mostPlayed) => `${plays/mostPlayed * 100}%`, + bookStatus: (books, status) => books.filter(book => book.status === status), // tags filterTags: (tags) => { diff --git a/package.json b/package.json index 428508af..392b6826 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "12.0.9", + "version": "12.1.9", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": { diff --git a/src/_data/books.js b/src/_data/books.js index fe62d03c..03770b47 100644 --- a/src/_data/books.js +++ b/src/_data/books.js @@ -1,63 +1,18 @@ -import jsdom from 'jsdom' -import { AssetCache } from '@11ty/eleventy-fetch' - -const { JSDOM } = jsdom +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const books = require('./json/read.json') export default async function () { - const COOKIE = process.env.COOKIE_STORYGRAPH - const url = 'https://app.thestorygraph.com/currently-reading/coryd' - const asset = new AssetCache('books_data') - if (asset.isCacheValid('1h')) return await asset.getCachedValue() - const data = [] - await fetch(url, { - headers: { - Cookie: COOKIE, - }, - }) - .then((res) => res.text()) - .then((html) => { - const DOM = new JSDOM(html) - const doc = DOM.window.document - const bookCount = doc.querySelectorAll('.book-pane-content').length - const titles = doc.querySelectorAll('.book-title-author-and-series h3 > a') - const authors = doc.querySelectorAll('.book-title-author-and-series h3 p:last-of-type > a') - const images = doc.querySelectorAll('.md\\:block .book-cover img') - const urls = doc.querySelectorAll('.md\\:block .book-cover a') - const percentages = doc.querySelectorAll('.md\\:block .progress-tracker-pane .font-semibold') - const dates = doc.querySelectorAll('.md\\:block .action-menu a p') - - for (let i = 0; i < bookCount; i++) { - const date = new Date( - dates[i]?.textContent.replace('Started ', '').split('\n')[0] - ).toLocaleString('en-US', { - timeZone: 'America/Los_Angeles', - }) - - if (!data[i]) { - data.push({ title: titles[i]?.textContent }) - data.push({ author: authors[i]?.textContent }) - data.push({ image: `https://coryd.dev/.netlify/images/?url=${images[i]?.src}&fit=cover&w=200&h=307`, - }) - data.push({ url: `https://app.thestorygraph.com${urls[i].href}` }) - data.push({ percentage: percentages[i]?.textContent }) - data.push({ - dateAdded: date, - }) - data.push({ type: 'book' }) - } - - if (data[i]) { - data[i]['title'] = titles[i]?.textContent - data[i]['author'] = authors[i]?.textContent - data[i]['image'] = `https://coryd.dev/.netlify/images/?url=${images[i]?.src}&fit=cover&w=200&h=307`, - data[i]['url'] = `https://app.thestorygraph.com${urls[i]?.href}` - data[i]['percentage'] = percentages[i]?.textContent - data[i]['dateAdded'] = date - data[i]['type'] = 'book' - } - } - }) - const books = data.filter((book) => book.title) - await asset.save(books, 'json') - return books + return books.map(book => ( + { + title: book['title'], + authors: book['authors'].length > 1 ? book['authors'].join(', ') : book['authors'][0], + description: book['description'], + image: `https://coryd.dev/.netlify/images/?url=${encodeURIComponent(book['thumbnail'].replace('&edge=curl', ''))}&fit=cover&w=200&h=307`, + url: `https://openlibrary.org/isbn/${book['isbn']}`, + dateAdded: book['dateStarted'], + status: book['status'], + type: 'book', + } + )) } diff --git a/src/_data/json/roundups/2023.js b/src/_data/json/roundups/2023.js index 8444fe7f..7329bd79 100644 --- a/src/_data/json/roundups/2023.js +++ b/src/_data/json/roundups/2023.js @@ -3,38 +3,44 @@ export default { { alt: 'Stay True', author: 'Hua Hsu', - image: 'https://coryd.dev/.netlify/images/?url=https://cdn.thestorygraph.com/8jdewx4ipwb9hro2oedjkfj1cy0f&fit=cover&w=200&h=307', - url: 'https://app.thestorygraph.com/books/9946c834-81f1-4c7f-b7d1-30a804e9874f', + image: 'https://coryd.dev/.netlify/images/?url=https%3A%2F%2Fbooks.google.com%2Fbooks%2Fcontent%3Fid%3DXJ-OEAAAQBAJ%26printsec%3Dfrontcover%26img%3D1%26zoom%3D1%26source%3Dgbs_api%26w%3D512&fit=cover&w=200&h=307', + url: 'https://openlibrary.org/isbn/9780593663660', + type: 'book', }, { alt: 'Where Are Your Boys Tonight?', author: 'Chris Payne', - image: 'https://coryd.dev/.netlify/images/?url=https://cdn.thestorygraph.com/vajp3jxy6kee5ka2ymbvjc2fqkvf&fit=cover&w=200&h=307', - url: 'https://app.thestorygraph.com/books/f074d4e3-a9fc-42af-889e-54697a1fece0', + image: 'https://coryd.dev/.netlify/images/?url=https%3A%2F%2Fbooks.google.com%2Fbooks%2Fcontent%3Fid%3DsQtcEAAAQBAJ%26printsec%3Dfrontcover%26img%3D1%26zoom%3D1%26source%3Dgbs_api%26w%3D512&fit=cover&w=200&h=307', + url: 'https://openlibrary.org/isbn/9780063161573', + type: 'book', }, { title: 'Trouble Boys', author: 'Bob Mehr', - image: 'https://coryd.dev/.netlify/images/?url=https://cdn.thestorygraph.com/66eh71z4igv2dsinrk7mif50fa6y&fit=cover&w=200&h=307', - url: 'https://app.thestorygraph.com/books/8dce0e20-fef1-42a4-a59b-b4ec084dc6f4', + image: 'https://coryd.dev/.netlify/images/?url=https%3A%2F%2Fbooks.google.com%2Fbooks%2Fcontent%3Fid%3DxQ9SCwAAQBAJ%26printsec%3Dfrontcover%26img%3D1%26zoom%3D1%26source%3Dgbs_api%26w%3D512&fit=cover&w=200&h=307', + url: 'https://openlibrary.org/isbn/9780306818790', + type: 'book', }, { alt: 'Corporate Rock Sucks', author: 'Jim Ruland', - image: 'https://coryd.dev/.netlify/images/?url=https://cdn.thestorygraph.com/tzf2l7725ydzzvvmzpbky7wj7ckc&fit=cover&w=200&h=307', - url: 'https://app.thestorygraph.com/books/8a0b8649-8939-4753-8e8d-18500574614e', + image: 'https://coryd.dev/.netlify/images/?url=https%3A%2F%2Fbooks.google.com%2Fbooks%2Fcontent%3Fid%3DPEU7EAAAQBAJ%26printsec%3Dfrontcover%26img%3D1%26zoom%3D1%26source%3Dgbs_api%26w%3D512&fit=cover&w=200&h=307', + url: 'https://openlibrary.org/isbn/9780306925474', + type: 'book', }, { alt: 'Tracers in the Dark', author: 'Andy Greenberg', - image: 'https://coryd.dev/.netlify/images/?url=https://cdn.thestorygraph.com/m4s6lp9eljzk5vjm1xauou8frxde&fit=cover&w=200&h=307', - url: 'https://app.thestorygraph.com/books/4f1f21f8-3d1f-4162-9f6c-5a00a33f629c', + image: 'https://coryd.dev/.netlify/images/?url=https%3A%2F%2Fbooks.google.com%2Fbooks%2Fcontent%3Fid%3DuytfEAAAQBAJ%26printsec%3Dfrontcover%26img%3D1%26zoom%3D1%26source%3Dgbs_api%26w%3D512&fit=cover&w=200&h=307', + url: 'http://openlibrary.org/isbn/9780385548106', + type: 'book', }, { alt: 'Girl in a Band', author: 'Kim Gordon', - image: 'https://coryd.dev/.netlify/images/?url=https://cdn.thestorygraph.com/qnxw68i4xn3byegvkzq6kty0rlx7&fit=cover&w=200&h=307', - url: 'https://app.thestorygraph.com/books/c0ea8ac6-d2c6-43b6-be16-ba793e71bfc2', + image: 'https://coryd.dev/.netlify/images/?url=https%3A%2F%2Fbooks.google.com%2Fbooks%2Fcontent%3Fid%3DJNOIBAAAQBAJ%26printsec%3Dfrontcover%26img%3D1%26zoom%3D1%26source%3Dgbs_api%26w%3D512&fit=cover&w=200&h=307', + url: 'https://openlibrary.org/isbn/9780062295910', + type: 'book', } ], albums: [ diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid index e4319062..563fa679 100644 --- a/src/_includes/now.liquid +++ b/src/_includes/now.liquid @@ -87,7 +87,8 @@ layout: default {% tablericon "books" "Books" %} Books -{% render "partials/now/media-grid.liquid", data:books, shape: "vertical", count: 6 %} +{% assign bookData = books | bookStatus: 'started' %} +{% render "partials/now/media-grid.liquid", data:bookData, shape: "vertical", count: 6 %} {% render "partials/recent-links.liquid", links:collections.links %}

{% tablericon "movie" "Movies" %} diff --git a/src/_includes/partials/now/media-grid.liquid b/src/_includes/partials/now/media-grid.liquid index 62b5434b..bb2f68f1 100644 --- a/src/_includes/partials/now/media-grid.liquid +++ b/src/_includes/partials/now/media-grid.liquid @@ -3,21 +3,21 @@
{% for item in media limit: count %} {% assign alt = item.alt | strip | escape %} + {% assign hasMeta = item.type != 'book' and item.type != 'movie' %} -
-
- {% if item.title %} -
{{ item.title }}
- {% endif %} - {% if item.percentage %} - {% render "partials/now/progress-bar.liquid", percentage:item.percentage %} - {% endif %} - {% if item.subtext %} -
- {{ item.subtext }} -
- {% endif %} -
+
+ {% if hasMeta %} +
+ {% if item.title %} +
{{ item.title }}
+ {% endif %} + {% if item.subtext %} +
+ {{ item.subtext }} +
+ {% endif %} +
+ {% endif %} {%- capture loadingStrategy -%} {%- if loading -%}{{ loading }}{%- else -%}lazy{%- endif -%} {%- endcapture -%} diff --git a/src/pages/uses.md b/src/pages/uses.md index 3597c9fa..15697597 100644 --- a/src/pages/uses.md +++ b/src/pages/uses.md @@ -72,7 +72,6 @@ Software and services that I use for work and my own enjoyment. - [forwardemail.net](https://forwardemail.net): a simple and reliable service for forwarding and routing emails from a few of the domains I own. - [Last.fm](https://last.fm): as it turns out, the best music recommendations still come from dedicated fans. - [Trakt](https://trakt.tv): my preferred TV and movie tracking service — it has a strong community (and isn't owned by a private equity firm). -- [The Storygraph](https://thestorygraph.com): an excellent, focused and community driven book tracking app. All it needs is RSS/Atom feeds and/or an API. - [Slack](http://slack.com): I have a family Slack set up to avoid group text messages and am in a few other community Slacks. - [Discord](http://discord.com): I don't _like_ Discord but, for better or worse, it's where some communities I frequent are. - [Backblaze](https://backblaze.com): It backs up my MacBook Air and attached storage drive and I don't have to think about it. diff --git a/src/posts/2023/2023-in-review.html b/src/posts/2023/2023-in-review.html index f5e38213..201217f5 100644 --- a/src/posts/2023/2023-in-review.html +++ b/src/posts/2023/2023-in-review.html @@ -10,7 +10,7 @@ tags: ['books', 'music', 'development', 'Eleventy']
  • I kept writing front end code — I have loved diving into Eleventy and the community around it.
  • The omg.lol community has also been incredible to hang around with and I should pop into the Discord more.
  • I got 4 more tattoos done in as many sessions, with 2 more sessions scheduled for next year.
  • -
  • I read 72 books
  • +
  • I read 72 books
  • I listened to a bunch of music
  • I watched a bunch of movies and TV, but picking favorites feels weird when so much of that consisted of catching up on "classics" and things I'd either ignored or never seen.