chore: perf improvements

This commit is contained in:
Cory Dransfeldt 2023-05-26 17:09:02 -07:00
parent bb9a086c32
commit de5cb2db8b
No known key found for this signature in database
4 changed files with 21 additions and 6 deletions

View file

@ -12,7 +12,9 @@
"listenbrainz": "https://listenbrainz.org/user/cdransf/",
"pinboard": "https://pinboard.in/u:cdme/profile/public/",
"letterboxd": "https://letterboxd.com/cdme",
"letterboxd-host": "https://a.ltrbxd.com",
"trakt": "https://trakt.tv/users/cdransf",
"oku": "https://oku.club/user/cory",
"coffee": "https://www.buymeacoffee.com/cory"
"coffee": "https://www.buymeacoffee.com/cory",
"cdn-movies": "https://movies.coryd.dev"
}

View file

@ -7,10 +7,17 @@ module.exports = async function () {
// noinspection JSCheckFunctionSignatures
const asset = new AssetCache('tv_data')
if (asset.isCacheValid('1h')) return await asset.getCachedValue()
const res = await extract(url).catch((error) => {
const res = await extract(url, {
getExtraEntryFields: (feedEntry) => {
const image = feedEntry['media:thumbnail']['@_url']
return {
image,
}
},
}).catch((error) => {
console.log(error.message)
})
const data = res.entries.splice(0, 5)
const data = res.entries.splice(0, 6)
await asset.save(data, 'json')
return data
}

View file

@ -145,7 +145,7 @@ layout: main
<div class="px-1 text-xs font-bold text-white">{{ movie.title }}</div>
</div>
<img
src="{{movie.image}}"
src="{{movie.image | proxy: site.letterboxd-host, site.cdn-movies}}"
onerror="this.onerror=null; this.src='/assets/img/media/404-movie.jpg'"
width="226"
height="337"