chore: refactoring
This commit is contained in:
parent
df5fddefc0
commit
e0593447eb
40 changed files with 181 additions and 232 deletions
|
@ -1,5 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
import { DateTime } from 'luxon'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
|
@ -38,7 +37,7 @@ const fetchAlbumReleases = async () => {
|
|||
total_plays: album['artist_total_plays'],
|
||||
country: album['artist_country'],
|
||||
favorite: album['artist_favorite'],
|
||||
url: `/music/artists/${sanitizeMediaString(album['artist_name'])}-${sanitizeMediaString(parseCountryField(album['artist_country']))}`,
|
||||
url: album['artist_url'],
|
||||
},
|
||||
title: album['name'],
|
||||
date: releaseDate.toLocaleString(DateTime.DATE_FULL),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
import { parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -15,8 +15,8 @@ const fetchAllArtists = async () => {
|
|||
.from('optimized_artists')
|
||||
.select(`
|
||||
id,
|
||||
mbid,
|
||||
name_string,
|
||||
url,
|
||||
tentative,
|
||||
total_plays,
|
||||
country,
|
||||
|
@ -51,57 +51,49 @@ const fetchAllArtists = async () => {
|
|||
|
||||
const processArtists = (artists) => {
|
||||
return artists.map(artist => ({
|
||||
id: artist['id'],
|
||||
mbid: artist['mbid'],
|
||||
name: artist['name_string'],
|
||||
tentative: artist['tentative'],
|
||||
totalPlays: artist['total_plays'],
|
||||
country: parseCountryField(artist['country']),
|
||||
description: artist['description'],
|
||||
favorite: artist['favorite'],
|
||||
genre: artist['genre'],
|
||||
genre: {
|
||||
name: artist['genre']['name'],
|
||||
url: artist['genre']['url'],
|
||||
},
|
||||
emoji: artist['emoji'],
|
||||
tattoo: artist['tattoo'],
|
||||
image: artist['art'] ? `/${artist['art']}` : '',
|
||||
url: `/music/artists/${sanitizeMediaString(artist['name_string'])}-${sanitizeMediaString(parseCountryField(artist['country']))}`,
|
||||
url: artist['url'],
|
||||
albums: (artist['albums'] || []).map(album => ({
|
||||
id: album['id'],
|
||||
name: album['name'],
|
||||
releaseYear: album['release_year'],
|
||||
totalPlays: album['total_plays'],
|
||||
art: album.art ? `/${album['art']}` : ''
|
||||
})).sort((a, b) => a['release_year'] - b['release_year']),
|
||||
concerts: artist['concerts']?.[0]?.['id'] ? artist['concerts'].sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
books: artist['books']?.[0]?.['id'] ? artist['books'].map(book => ({
|
||||
concerts: artist['concerts'] ? artist['concerts'].sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
books: artist['books'] ? artist['books'].map(book => ({
|
||||
title: book['title'],
|
||||
author: book['author'],
|
||||
isbn: book['isbn'],
|
||||
description: book['description'],
|
||||
url: `/books/${book['isbn']}`,
|
||||
})).sort((a, b) => a['title'].localeCompare(b['title'])) : null,
|
||||
movies: artist['movies']?.[0]?.['id'] ? artist['movies'].map(movie => ({
|
||||
movies: artist['movies'] ? artist['movies'].map(movie => ({
|
||||
title: movie['title'],
|
||||
year: movie['year'],
|
||||
tmdb_id: movie['tmdb_id'],
|
||||
url: `/watching/movies/${movie['tmdb_id']}`,
|
||||
})).sort((a, b) => b['year'] - a['year']) : null,
|
||||
shows: artist['shows']?.[0]?.['id'] ? artist['shows'].map(show => ({
|
||||
shows: artist['shows'] ? artist['shows'].map(show => ({
|
||||
title: show['title'],
|
||||
year: show['year'],
|
||||
tmdb_id: show['tmdb_id'],
|
||||
url: `/watching/shows/${show['tmdb_id']}`,
|
||||
})).sort((a, b) => b['year'] - a['year']) : null,
|
||||
posts: artist['posts']?.[0]?.['id'] ? artist['posts'].map(post => ({
|
||||
id: post['id'],
|
||||
posts: artist['posts'] ? artist['posts'].map(post => ({
|
||||
title: post['title'],
|
||||
date: post['date'],
|
||||
slug: post['slug'],
|
||||
url: post['slug'],
|
||||
url: post['url'],
|
||||
})).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
relatedArtists: artist['related_artists']?.[0]?.['id'] ? artist['related_artists'].map(relatedArtist => {
|
||||
relatedArtist['url'] = `/music/artists/${sanitizeMediaString(relatedArtist['name'])}-${sanitizeMediaString(parseCountryField(relatedArtist['country']))}`
|
||||
return relatedArtist
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
relatedArtists: artist['related_artists'] ? artist['related_artists'].sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import slugify from 'slugify'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -71,35 +69,25 @@ const processBooks = (books) => {
|
|||
status: book['read_status'],
|
||||
progress: book['progress'],
|
||||
tags: Array.isArray(book['tags']) ? book['tags'] : book['tags']?.split(',') || [],
|
||||
isbn: book['isbn'],
|
||||
type: 'book',
|
||||
artists: book['artists']?.[0]?.['id'] ? book['artists'].map(artist => {
|
||||
artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}`
|
||||
return artist
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
movies: book['movies']?.[0]?.['id'] ? book['movies'].map(movie => {
|
||||
artists: book['artists'] ? book['artists'].sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
movies: book['movies'] ? book['movies'].map(movie => {
|
||||
movie['url'] = `/watching/movies/${movie['tmdb_id']}`
|
||||
return movie
|
||||
}).sort((a, b) => b['year'] - a['year']) : null,
|
||||
genres: book['genres']?.[0]?.['id'] ? book['genres'].map(genre => {
|
||||
genre['url'] = `/music/genres/${slugify(genre['name'].replace('/', '-').toLowerCase())}`
|
||||
return genre
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
shows: book['shows']?.[0]?.['id'] ? book['shows'].map(show => {
|
||||
genres: book['genres'] ? book['genres'].sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
shows: book['shows'] ? book['shows'].map(show => {
|
||||
show['url'] = `/watching/shows/${show['tmdb_id']}`
|
||||
return show
|
||||
}).sort((a, b) => b['year'] - a['year']) : null,
|
||||
posts: book['posts']?.[0]?.['id'] ? book['posts'].map(post => ({
|
||||
id: post['id'],
|
||||
posts: book['posts'] ? book['posts'].map(post => ({
|
||||
title: post['title'],
|
||||
date: post['date'],
|
||||
slug: post['slug'],
|
||||
url: post['slug'],
|
||||
url: post['url'],
|
||||
})).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
relatedBooks: book['related_books']?.[0]?.['id'] ? book['related_books'].map(relatedBook => ({
|
||||
relatedBooks: book['related_books'] ? book['related_books'].map(relatedBook => ({
|
||||
title: relatedBook['title'],
|
||||
author: relatedBook['author'],
|
||||
isbn: relatedBook['isbn'],
|
||||
description: relatedBook['description'],
|
||||
url: `/books/${relatedBook['isbn']}`,
|
||||
})).sort((a, b) => a['title'].localeCompare(b['title'])) : null, // Add related books processing
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
import { parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -26,7 +26,6 @@ const fetchAllConcerts = async () => {
|
|||
bounding_box,
|
||||
venue_notes,
|
||||
artist_name,
|
||||
artist_mbid,
|
||||
artist_country
|
||||
`)
|
||||
.range(rangeStart, rangeStart + PAGE_SIZE - 1)
|
||||
|
@ -61,11 +60,9 @@ const processConcerts = (concerts) => {
|
|||
notes: concert['concert_notes'],
|
||||
artist: concert['artist'] ? {
|
||||
name: concert['artist_name'],
|
||||
mbid: concert['artist_mbid'],
|
||||
country: parseCountryField(concert['artist_country'])
|
||||
} : null,
|
||||
url: `/music/concerts?id=${concert['id']}`,
|
||||
artistUrl: concert['artist'] ? `/music/artists/${sanitizeMediaString(concert['artist_name'])}-${sanitizeMediaString(parseCountryField(concert['artist_country']))}` : null
|
||||
artistUrl: concert['artist'] ? concert['artist_url'] : null
|
||||
})).sort((a, b) => new Date(b['date']) - new Date(a['date']))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import slugify from 'slugify'
|
||||
import { parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -14,14 +12,8 @@ const fetchGenresWithArtists = async () => {
|
|||
description,
|
||||
total_plays,
|
||||
wiki_link,
|
||||
artists (
|
||||
mbid,
|
||||
name_string,
|
||||
total_plays,
|
||||
country,
|
||||
description,
|
||||
favorite
|
||||
),
|
||||
url,
|
||||
artists,
|
||||
books,
|
||||
movies,
|
||||
posts
|
||||
|
@ -35,30 +27,23 @@ const fetchGenresWithArtists = async () => {
|
|||
|
||||
return data.map(genre => ({
|
||||
...genre,
|
||||
artists: genre['artists'].map(artist => ({
|
||||
...artist,
|
||||
country: parseCountryField(artist['country'])
|
||||
})),
|
||||
url: `/music/genres/${slugify(genre['name'].replace('/', '-').toLowerCase())}`,
|
||||
books: genre['books']?.[0]?.['id'] ? genre['books'].map(book => ({
|
||||
artists: genre['artists'],
|
||||
url: genre['url'],
|
||||
books: genre['books'] ? genre['books'].map(book => ({
|
||||
title: book['title'],
|
||||
author: book['author'],
|
||||
isbn: book['isbn'],
|
||||
description: book['description'],
|
||||
url: `/books/${book['isbn']}`,
|
||||
})).sort((a, b) => a['title'].localeCompare(b['title'])) : null,
|
||||
movies: genre['movies']?.[0]?.['id'] ? genre['movies'].map(movie => ({
|
||||
movies: genre['movies'] ? genre['movies'].map(movie => ({
|
||||
title: movie['title'],
|
||||
year: movie['year'],
|
||||
tmdb_id: movie['tmdb_id'],
|
||||
url: `/watching/movies/${movie['tmdb_id']}`,
|
||||
})).sort((a, b) => b['year'] - a['year']) : null,
|
||||
posts: genre['posts']?.[0]?.['id'] ? genre['posts'].map(post => ({
|
||||
id: post['id'],
|
||||
posts: genre['posts'] ? genre['posts'].map(post => ({
|
||||
title: post['title'],
|
||||
date: post['date'],
|
||||
slug: post['slug'],
|
||||
url: post['slug'],
|
||||
url: post['url'],
|
||||
})).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
}))
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { DateTime } from 'luxon'
|
||||
import slugify from 'slugify'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -71,33 +69,24 @@ const processMovies = (movies) => {
|
|||
tattoo: item['tattoo'],
|
||||
rating: item['star_rating'],
|
||||
review: item['review'],
|
||||
id: item['tmdb_id'],
|
||||
type: 'movie',
|
||||
tags: item['tags'] ? item['tags'].split(',') : [],
|
||||
artists: item['artists']?.[0]?.['id'] ? item['artists'].map(artist => {
|
||||
artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}`
|
||||
return artist
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
books: item['books']?.[0]?.['id'] ? item['books'].map(book => {
|
||||
artists: item['artists'] ? item['artists'].sort((a, b) => a['name'].localeCompare(b['name'])) : null,
|
||||
books: item['books'] ? item['books'].map(book => {
|
||||
book['url'] = `/books/${book['isbn']}`
|
||||
return book
|
||||
}).sort((a, b) => a['title'].localeCompare(b['title'])) : null,
|
||||
genres: item['genres']?.[0]?.['id'] ? item['genres'].map(genre => {
|
||||
genre['url'] = `/music/genres/${slugify(genre['name'].replace('/', '-').toLowerCase())}`
|
||||
return genre
|
||||
}).sort((a, b) => a['title'].localeCompare(b['title'])) : null,
|
||||
shows: item['shows']?.[0]?.['id'] ? item['shows'].map(show => {
|
||||
genres: item['genres'] ? item['genres'].sort((a, b) => a['title'].localeCompare(b['title'])) : null,
|
||||
shows: item['shows'] ? item['shows'].map(show => {
|
||||
show['url'] = `/watching/shows/${show['tmdb_id']}`
|
||||
return show
|
||||
}).sort((a, b) => b['year'] - a['year']) : null,
|
||||
posts: item['posts']?.[0]?.['id'] ? item['posts'].map(post => ({
|
||||
id: post['id'],
|
||||
posts: item['posts'] ? item['posts'].map(post => ({
|
||||
title: post['title'],
|
||||
date: post['date'],
|
||||
slug: post['slug'],
|
||||
url: post['slug'],
|
||||
url: post['url'],
|
||||
})).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
relatedMovies: item['related_movies']?.[0]?.['id'] ? item['related_movies'].map(movie => {
|
||||
relatedMovies: item['related_movies'] ? item['related_movies'].map(movie => {
|
||||
movie['url'] = `/watching/movies/${movie['tmdb_id']}`
|
||||
return movie
|
||||
}).sort((a, b) => b['year'] - a['year']) : null,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -56,8 +55,7 @@ const aggregateData = (data, groupByField, groupByType, genreMapping) => {
|
|||
aggregation[key] = {
|
||||
title: item[groupByField],
|
||||
plays: 0,
|
||||
mbid: item[groupByType]?.['mbid'] || '',
|
||||
url: `/music/artists/${sanitizeMediaString(item['artist_name'])}-${sanitizeMediaString(parseCountryField(item['artist_country']))}`,
|
||||
url: item['artist_url'],
|
||||
image: `/${item[groupByType]}`,
|
||||
type: groupByType === 'artist_art' ? 'artist' : groupByType === 'album_art' ? 'album' : groupByType,
|
||||
genre: genreMapping[item['artist_genres']] || ''
|
||||
|
@ -74,7 +72,7 @@ const buildRecents = (data) => {
|
|||
return data.map(listen => ({
|
||||
title: listen['track_name'],
|
||||
artist: listen['artist_name'],
|
||||
url: `/music/artists/${sanitizeMediaString(listen['artist_name'])}-${sanitizeMediaString(parseCountryField(listen['artist_country']))}`,
|
||||
url: listen['artist_url'],
|
||||
timestamp: listen['listened_at'],
|
||||
image: `/${listen['album_art']}`
|
||||
})).sort((a, b) => b.timestamp - a.timestamp)
|
||||
|
@ -85,8 +83,7 @@ const aggregateGenres = (data, genreMapping) => {
|
|||
|
||||
data.forEach(item => {
|
||||
const genre = genreMapping[item['artist_genres']] || ''
|
||||
|
||||
if (!genreAggregation[genre]) genreAggregation[genre] = { genre, plays: 0 }
|
||||
if (!genreAggregation[genre]) genreAggregation[genre] = { name: genre, url: item['genre_url'], plays: 0 }
|
||||
genreAggregation[genre]['plays']++
|
||||
})
|
||||
return Object.values(genreAggregation).sort((a, b) => b['plays'] - a['plays'])
|
||||
|
@ -99,12 +96,12 @@ export default async function () {
|
|||
artist_name,
|
||||
album_name,
|
||||
album_key,
|
||||
artist_mbid,
|
||||
artist_art,
|
||||
artist_genres,
|
||||
artist_country,
|
||||
album_mbid,
|
||||
album_art
|
||||
album_art,
|
||||
artist_url,
|
||||
genre_url
|
||||
`
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import slugify from 'slugify'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env['SUPABASE_URL']
|
||||
const SUPABASE_KEY = process.env['SUPABASE_KEY']
|
||||
|
@ -110,34 +108,27 @@ const processPosts = async (posts, tagsByPostId, blocksByPostId) => {
|
|||
})).then(blocks => blocks.filter(block => block !== null))
|
||||
|
||||
// artists
|
||||
post['artists'] = post['artists']?.[0]?.['id'] ? post['artists'].map(artist => {
|
||||
artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}`
|
||||
return artist
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null
|
||||
post['artists'] = post['artists'] ? post['artists'].sort((a, b) => a['name'].localeCompare(b['name'])) : null
|
||||
|
||||
// books
|
||||
post['books'] = post['books']?.[0]?.['id'] ? post['books'].map(book => ({
|
||||
post['books'] = post['books'] ? post['books'].map(book => ({
|
||||
title: book['title'],
|
||||
author: book['author'],
|
||||
isbn: book['isbn'],
|
||||
description: book['description'],
|
||||
url: `/books/${book['isbn']}`,
|
||||
})).sort((a, b) => a['title'].localeCompare(b['title'])) : null
|
||||
|
||||
// movies
|
||||
post['movies'] = post['movies']?.[0]?.['id'] ? post['movies'].map(movie => {
|
||||
post['movies'] = post['movies'] ? post['movies'].map(movie => {
|
||||
movie['url'] = `/watching/movies/${movie['tmdb_id']}`
|
||||
return movie
|
||||
}).sort((a, b) => b['year'] - a['year']) : null
|
||||
|
||||
// genres
|
||||
post['genres'] = post['genres']?.[0]?.['id'] ? post['genres'].map(genre => {
|
||||
genre['url'] = `/music/genres/${slugify(genre['name'].replace('/', '-').toLowerCase())}`
|
||||
return genre
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null
|
||||
post['genres'] = post['genres'] ? post['genres'].sort((a, b) => a['name'].localeCompare(b['name'])) : null
|
||||
|
||||
// shows
|
||||
post['shows'] = post['shows']?.[0]?.['id'] ? post['shows'].map(show => {
|
||||
post['shows'] = post['shows'] ? post['shows'].map(show => {
|
||||
show['url'] = `/watching/shows/${show['tmdb_id']}`
|
||||
return show
|
||||
}).sort((a, b) => b['year'] - a['year']) : null
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { sanitizeMediaString, parseCountryField } from '../../config/utilities/index.js'
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
|
@ -56,35 +55,27 @@ const prepareShowData = (show) => ({
|
|||
episodes: show['episodes'] || [],
|
||||
tattoo: show['tattoo'],
|
||||
tags: Array.isArray(show['tags']) ? show['tags'] : show['tags']?.split(',') || [],
|
||||
movies: show['movies']?.[0]?.['id'] ? show['movies'].map(movie => {
|
||||
movies: show['movies'] ? show['movies'].map(movie => {
|
||||
movie['url'] = `/watching/movies/${movie['tmdb_id']}`
|
||||
return movie
|
||||
}).sort((a, b) => b['year'] - a['year']) : null,
|
||||
books: show['books']?.[0]?.['id'] ? show['books'].map(book => ({
|
||||
books: show['books'] ? show['books'].map(book => ({
|
||||
title: book['title'],
|
||||
author: book['author'],
|
||||
isbn: book['isbn'],
|
||||
description: book['description'],
|
||||
url: `/books/${book['isbn']}`,
|
||||
})).sort((a, b) => a['title'].localeCompare(b['title'])) : null,
|
||||
posts: show['posts']?.[0]?.['id'] ? show['posts'].map(post => ({
|
||||
id: post['id'],
|
||||
posts: show['posts'] ? show['posts'].map(post => ({
|
||||
title: post['title'],
|
||||
date: post['date'],
|
||||
slug: post['slug'],
|
||||
url: post['slug'],
|
||||
url: post['url'],
|
||||
})).sort((a, b) => new Date(b['date']) - new Date(a['date'])) : null,
|
||||
relatedShows: show['related_shows']?.[0]?.['id'] ? show['related_shows'].map(relatedShow => ({
|
||||
id: relatedShow['id'],
|
||||
relatedShows: show['related_shows'] ? show['related_shows'].map(relatedShow => ({
|
||||
title: relatedShow['title'],
|
||||
year: relatedShow['year'],
|
||||
tmdb_id: relatedShow['tmdb_id'],
|
||||
url: `/watching/shows/${relatedShow['tmdb_id']}`,
|
||||
})).sort((a, b) => b['year'] - a['year']) : null,
|
||||
artists: show['artists']?.[0]?.['id'] ? show['artists'].map(artist => {
|
||||
artist['url'] = `/music/artists/${sanitizeMediaString(artist['name'])}-${sanitizeMediaString(parseCountryField(artist['country']))}`
|
||||
return artist
|
||||
}).sort((a, b) => a['name'].localeCompare(b['name'])) : null, // Add artists processing
|
||||
artists: show['artists'] ? show['artists'].sort((a, b) => a['name'].localeCompare(b['name'])) : null
|
||||
})
|
||||
|
||||
const prepareEpisodeData = (show) => show['episodes'].map(episode => ({
|
||||
|
|
Reference in a new issue