eS v1
This commit is contained in:
411
server/api/tracks/compilation.ts
Normal file
411
server/api/tracks/compilation.ts
Normal file
@@ -0,0 +1,411 @@
|
||||
import { eventHandler } from 'h3'
|
||||
|
||||
export default eventHandler(() => {
|
||||
const tracks = [
|
||||
{
|
||||
order: 1,
|
||||
boxId: 'ES00A',
|
||||
title: 'The grinding wheel',
|
||||
artist: 0,
|
||||
start: 0,
|
||||
link: 'https://arakirecords.bandcamp.com/track/the-grinding-wheel',
|
||||
coverId: 'a3236746052'
|
||||
},
|
||||
{
|
||||
order: 2,
|
||||
boxId: 'ES00A',
|
||||
title: 'Bleach',
|
||||
artist: 1,
|
||||
start: 392,
|
||||
link: 'https://the-kundalini-genie.bandcamp.com/track/bleach-2',
|
||||
coverId: 'a1714786533'
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
boxId: 'ES00A',
|
||||
title: 'Televised mind',
|
||||
artist: 2,
|
||||
start: 896,
|
||||
link: 'https://fontainesdc.bandcamp.com/track/televised-mind',
|
||||
coverId: 'a3772806156'
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
boxId: 'ES00A',
|
||||
title: 'In it',
|
||||
artist: 3,
|
||||
start: 1139,
|
||||
link: 'https://howlinbananarecords.bandcamp.com/track/in-it',
|
||||
coverId: 'a1720372066'
|
||||
},
|
||||
{
|
||||
order: 5,
|
||||
boxId: 'ES00A',
|
||||
title: 'Bad michel',
|
||||
artist: 4,
|
||||
start: 1245,
|
||||
link: 'https://johnnymafia.bandcamp.com/track/bad-michel-3',
|
||||
coverId: 'a0984622869'
|
||||
},
|
||||
{
|
||||
order: 6,
|
||||
boxId: 'ES00A',
|
||||
title: 'Overall',
|
||||
artist: 5,
|
||||
start: 1394,
|
||||
link: 'https://newcandys.bandcamp.com/track/overall',
|
||||
coverId: 'a0559661270'
|
||||
},
|
||||
{
|
||||
order: 7,
|
||||
boxId: 'ES00A',
|
||||
title: 'Blowup',
|
||||
artist: 6,
|
||||
start: 1674,
|
||||
link: 'https://magicshoppe.bandcamp.com/track/blowup',
|
||||
coverId: 'a1444895293'
|
||||
},
|
||||
{
|
||||
order: 8,
|
||||
boxId: 'ES00A',
|
||||
title: 'Guitar jet',
|
||||
artist: 7,
|
||||
start: 1880,
|
||||
link: 'https://radiomartiko.bandcamp.com/track/guitare-jet',
|
||||
coverId: 'a1494681687'
|
||||
},
|
||||
{
|
||||
order: 9,
|
||||
boxId: 'ES00A',
|
||||
title: 'Intercontinental radio waves',
|
||||
artist: 8,
|
||||
start: 2024,
|
||||
link: 'https://traams.bandcamp.com/track/intercontinental-radio-waves',
|
||||
coverId: 'a0046738552'
|
||||
},
|
||||
{
|
||||
order: 10,
|
||||
boxId: 'ES00A',
|
||||
title: 'Here comes the sun',
|
||||
artist: 9,
|
||||
start: 2211,
|
||||
link: 'https://blue-orchid.bandcamp.com/track/here-come-the-sun',
|
||||
coverId: 'a4102567047'
|
||||
},
|
||||
{
|
||||
order: 11,
|
||||
boxId: 'ES00A',
|
||||
title: 'Like in the movies',
|
||||
artist: 10,
|
||||
start: 2560,
|
||||
link: 'https://bruitblanc.bandcamp.com/track/like-in-the-movies-2',
|
||||
coverId: 'a2203158939'
|
||||
},
|
||||
{
|
||||
order: 1,
|
||||
boxId: 'ES00B',
|
||||
title: "Ce que révèle l'éclipse",
|
||||
artist: 0,
|
||||
start: 0,
|
||||
link: 'https://arakirecords.bandcamp.com/track/ce-que-r-v-le-l-clipse',
|
||||
coverId: 'a3236746052'
|
||||
},
|
||||
{
|
||||
order: 2,
|
||||
boxId: 'ES00B',
|
||||
title: "Bleedin' Gums Mushrool",
|
||||
artist: 1,
|
||||
start: 263,
|
||||
link: 'https://the-kundalini-genie.bandcamp.com/track/bleedin-gums-mushroom',
|
||||
coverId: 'a1714786533'
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
boxId: 'ES00B',
|
||||
title: 'A lucid dream',
|
||||
artist: 2,
|
||||
start: 554,
|
||||
link: 'https://fontainesdc.bandcamp.com/track/a-lucid-dream',
|
||||
coverId: 'a3772806156'
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
boxId: 'ES00B',
|
||||
title: 'Lights off',
|
||||
artist: 3,
|
||||
start: 781,
|
||||
link: 'https://howlinbananarecords.bandcamp.com/track/lights-off',
|
||||
coverId: 'a1720372066'
|
||||
},
|
||||
{
|
||||
order: 5,
|
||||
boxId: 'ES00B',
|
||||
title: "I'm sentimental",
|
||||
artist: 4,
|
||||
start: 969,
|
||||
link: 'https://johnnymafia.bandcamp.com/track/im-sentimental-2',
|
||||
coverId: 'a2333676849'
|
||||
},
|
||||
{
|
||||
order: 6,
|
||||
boxId: 'ES00B',
|
||||
title: 'Thrill or trip',
|
||||
artist: 5,
|
||||
start: 1128,
|
||||
link: 'https://newcandys.bandcamp.com/track/thrill-or-trip',
|
||||
coverId: 'a0559661270'
|
||||
},
|
||||
{
|
||||
order: 7,
|
||||
boxId: 'ES00B',
|
||||
title: 'Redhead',
|
||||
artist: 6,
|
||||
start: 1303,
|
||||
link: 'https://magicshoppe.bandcamp.com/track/redhead',
|
||||
coverId: 'a0594426943'
|
||||
},
|
||||
{
|
||||
order: 8,
|
||||
boxId: 'ES00B',
|
||||
title: 'Supersonic twist',
|
||||
artist: 7,
|
||||
start: 1584,
|
||||
link: 'https://open.spotify.com/track/66voQIZAJ3zD3Eju2qtNjF',
|
||||
coverId: 'a1494681687'
|
||||
},
|
||||
{
|
||||
order: 9,
|
||||
boxId: 'ES00B',
|
||||
title: 'Flowers',
|
||||
artist: 8,
|
||||
start: 1749,
|
||||
link: 'https://traams.bandcamp.com/track/flowers',
|
||||
coverId: 'a3644668199'
|
||||
},
|
||||
{
|
||||
order: 10,
|
||||
boxId: 'ES00B',
|
||||
title: 'The shade',
|
||||
artist: 9,
|
||||
start: 1924,
|
||||
link: 'https://blue-orchid.bandcamp.com/track/the-shade',
|
||||
coverId: 'a0804204790'
|
||||
},
|
||||
{
|
||||
order: 11,
|
||||
boxId: 'ES00B',
|
||||
title: 'Like in the movies',
|
||||
artist: 10,
|
||||
start: 2186,
|
||||
link: 'https://bruitblanc.bandcamp.com/track/like-in-the-movies',
|
||||
coverId: 'a3647322740'
|
||||
},
|
||||
{
|
||||
order: 1,
|
||||
boxId: 'ES01A',
|
||||
title: 'He Walked In',
|
||||
artist: 11,
|
||||
start: 0,
|
||||
link: 'https://kidcongothepinkmonkeybirds.bandcamp.com/track/he-walked-in',
|
||||
coverId: 'a0336300523'
|
||||
},
|
||||
{
|
||||
order: 2,
|
||||
boxId: 'ES01A',
|
||||
title: 'The Third Wave',
|
||||
artist: 12,
|
||||
start: 841,
|
||||
link: 'https://firefriend.bandcamp.com/track/the-third-wave',
|
||||
coverId: 'a2803689859'
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
boxId: 'ES01A',
|
||||
title: 'Broadcaster',
|
||||
artist: 13,
|
||||
start: 1104.5,
|
||||
link: 'https://squiduk.bandcamp.com/track/broadcaster',
|
||||
coverId: 'a3391719769'
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
boxId: 'ES01A',
|
||||
title: 'Mourn',
|
||||
artist: 14,
|
||||
start: 1441,
|
||||
link: 'https://lysistrata.bandcamp.com/track/mourn-2',
|
||||
coverId: 'a0872900041'
|
||||
},
|
||||
{
|
||||
order: 5,
|
||||
boxId: 'ES01A',
|
||||
title: 'Let it Blow',
|
||||
artist: 15,
|
||||
start: 1844.8,
|
||||
link: 'https://pabloxbroadcastingservices.bandcamp.com/track/let-it-blow',
|
||||
coverId: 'a4000148031'
|
||||
},
|
||||
{
|
||||
order: 6,
|
||||
boxId: 'ES01A',
|
||||
title: 'Sunday Mourning',
|
||||
artist: 16,
|
||||
start: 2091.7,
|
||||
link: 'https://nightbeats.bandcamp.com/track/sunday-mourning',
|
||||
coverId: 'a0031987121'
|
||||
},
|
||||
{
|
||||
order: 7,
|
||||
boxId: 'ES01A',
|
||||
title: '3030 Instrumental',
|
||||
artist: 17,
|
||||
start: 2339.3,
|
||||
link: 'https://delthefunkyhomosapien.bandcamp.com/track/3030',
|
||||
coverId: 'a1948146136'
|
||||
},
|
||||
{
|
||||
order: 8,
|
||||
boxId: 'ES01A',
|
||||
title: 'Immortality Break',
|
||||
artist: 18,
|
||||
start: 2530.5,
|
||||
link: 'https://theaa.bandcamp.com/track/immortality-break',
|
||||
coverId: 'a2749250329'
|
||||
},
|
||||
{
|
||||
order: 9,
|
||||
boxId: 'ES01A',
|
||||
title: 'Lazy Bones',
|
||||
artist: 19,
|
||||
start: 2718,
|
||||
link: 'https://woodenshjips.bandcamp.com/track/lazy-bones',
|
||||
coverId: 'a1884221104'
|
||||
},
|
||||
{
|
||||
order: 10,
|
||||
boxId: 'ES01A',
|
||||
title: 'On the Train of Aches',
|
||||
artist: 20,
|
||||
start: 2948,
|
||||
link: 'https://silasjdirge.bandcamp.com/track/on-the-train-of-aches',
|
||||
coverId: 'a1124177379'
|
||||
},
|
||||
{
|
||||
order: 11,
|
||||
boxId: 'ES01A',
|
||||
title: 'Me',
|
||||
artist: 21,
|
||||
start: 3265,
|
||||
link: 'https://secretcolours.bandcamp.com/track/me',
|
||||
coverId: 'a1497022499'
|
||||
},
|
||||
{
|
||||
order: 1,
|
||||
boxId: 'ES01B',
|
||||
title: 'Lady Hawke Blues',
|
||||
artist: 11,
|
||||
start: 0,
|
||||
link: 'https://kidcongothepinkmonkeybirds.bandcamp.com/track/lady-hawke-blues',
|
||||
coverId: 'a2532623230'
|
||||
},
|
||||
{
|
||||
order: 2,
|
||||
boxId: 'ES01B',
|
||||
title: 'Dreamscapes',
|
||||
artist: 12,
|
||||
start: 235,
|
||||
link: 'https://littlecloudrecords.bandcamp.com/track/dreamscapes',
|
||||
coverId: 'a3498981203'
|
||||
},
|
||||
{
|
||||
order: 3,
|
||||
boxId: 'ES01B',
|
||||
title: 'Crispy Skin',
|
||||
artist: 13,
|
||||
start: 644.2,
|
||||
link: 'https://squiduk.bandcamp.com/track/crispy-skin-2',
|
||||
coverId: 'a2516727021'
|
||||
},
|
||||
{
|
||||
order: 4,
|
||||
boxId: 'ES01B',
|
||||
title: 'The Boy Who Stood Above The Earth',
|
||||
artist: 14,
|
||||
start: 1018,
|
||||
link: 'https://lysistrata.bandcamp.com/track/the-boy-who-stood-above-the-earth-2',
|
||||
coverId: 'a0350933426'
|
||||
},
|
||||
{
|
||||
order: 5,
|
||||
boxId: 'ES01B',
|
||||
title: 'Better Off Alone',
|
||||
artist: 15,
|
||||
start: 1698,
|
||||
link: 'https://pabloxbroadcastingservices.bandcamp.com/track/better-off-alone',
|
||||
coverId: 'a4000148031'
|
||||
},
|
||||
{
|
||||
order: 6,
|
||||
boxId: 'ES01B',
|
||||
title: 'Celebration #1',
|
||||
artist: 16,
|
||||
start: 2235,
|
||||
link: 'https://nightbeats.bandcamp.com/track/celebration-1',
|
||||
coverId: 'a0031987121'
|
||||
},
|
||||
{
|
||||
order: 7,
|
||||
boxId: 'ES01B',
|
||||
title: '3030 Instrumental',
|
||||
artist: 17,
|
||||
start: 2458.3,
|
||||
link: 'https://delthefunkyhomosapien.bandcamp.com/track/3030',
|
||||
coverId: 'a1948146136'
|
||||
},
|
||||
{
|
||||
order: 8,
|
||||
boxId: 'ES01B',
|
||||
title: 'The Emptiness Of Nothingness',
|
||||
artist: 18,
|
||||
start: 2864.5,
|
||||
link: 'https://theaa.bandcamp.com/track/the-emptiness-of-nothingness',
|
||||
coverId: 'a1053923875'
|
||||
},
|
||||
{
|
||||
order: 9,
|
||||
boxId: 'ES01B',
|
||||
title: 'Rising',
|
||||
artist: 19,
|
||||
start: 3145,
|
||||
link: 'https://woodenshjips.bandcamp.com/track/rising',
|
||||
coverId: 'a1884221104'
|
||||
},
|
||||
{
|
||||
order: 10,
|
||||
boxId: 'ES01B',
|
||||
title: 'The Last Time',
|
||||
artist: 22,
|
||||
start: 3447,
|
||||
link: 'https://www.discogs.com/release/12110815-Larry-McNeil-And-The-Blue-Knights-Jealous-Woman',
|
||||
coverId:
|
||||
'https://i.discogs.com/Yr05_neEXwzPwKlDeV7dimmTG34atkAMgpxbMBhHBkI/rs:fit/g:sm/q:90/h:600/w:600/czM6Ly9kaXNjb2dz/LWRhdGFiYXNlLWlt/YWdlcy9SLTEyMTEw/ODE1LTE1Mjg1NjU1/NzQtMjcyOC5qcGVn.jpeg'
|
||||
},
|
||||
{
|
||||
order: 11,
|
||||
boxId: 'ES01B',
|
||||
title: 'Guajira Con Arpa',
|
||||
artist: 23,
|
||||
start: 3586,
|
||||
link: 'https://elpalmasmusic.bandcamp.com/track/guajira-con-arpa',
|
||||
coverId: 'a3463036407'
|
||||
}
|
||||
]
|
||||
|
||||
return tracks.map((track, index) => ({
|
||||
id: index + 1,
|
||||
...track,
|
||||
url: `https://files.erudi.fr/evilspins/${track.boxId}.mp3`,
|
||||
coverId: `https://f4.bcbits.com/img/${track.coverId}_4.jpg`,
|
||||
type: 'compilation',
|
||||
}))
|
||||
})
|
||||
74
server/api/tracks/playlist.ts
Normal file
74
server/api/tracks/playlist.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { eventHandler } from 'h3'
|
||||
import { getCardFromDate } from '../../../utils/cards'
|
||||
|
||||
export default eventHandler(async (event) => {
|
||||
const basePath = path.join(process.cwd(), '/mnt/media/files/music')
|
||||
|
||||
try {
|
||||
let allTracks: any[] = []
|
||||
|
||||
const dirPath = basePath
|
||||
const urlPrefix = `https://files.erudi.fr/music`
|
||||
|
||||
let files = await fs.promises.readdir(dirPath)
|
||||
files = files.filter((f) => !f.startsWith('.') && !f.endsWith('.jpg'))
|
||||
|
||||
const tracks = files.map((file, index) => {
|
||||
const EXT_RE = /\.(mp3|flac|wav|opus)$/i
|
||||
const nameWithoutExt = file.replace(EXT_RE, '')
|
||||
|
||||
// On split sur __
|
||||
const parts = nameWithoutExt.split('__')
|
||||
let stamp = parts[0] || ''
|
||||
let artist = parts[1] || ''
|
||||
let title = parts[2] || ''
|
||||
|
||||
title = title.replaceAll('_', ' ')
|
||||
artist = artist.replaceAll('_', ' ')
|
||||
|
||||
// Parser la date depuis le stamp
|
||||
let year = 2020,
|
||||
month = 1,
|
||||
day = 1,
|
||||
hour = 0
|
||||
if (stamp.length === 10) {
|
||||
year = Number(stamp.slice(0, 4))
|
||||
month = Number(stamp.slice(4, 6))
|
||||
day = Number(stamp.slice(6, 8))
|
||||
hour = Number(stamp.slice(8, 10))
|
||||
}
|
||||
|
||||
const date = new Date(year, month - 1, day, hour)
|
||||
const card = getCardFromDate(date)
|
||||
const url = `${urlPrefix}/${encodeURIComponent(file)}`
|
||||
const coverId = `${urlPrefix}/${encodeURIComponent(file).replace(EXT_RE, '.jpg')}`
|
||||
|
||||
return {
|
||||
id: Number(`${year}${index + 1}`),
|
||||
boxId: `ES${year}`,
|
||||
date,
|
||||
title: title.trim(),
|
||||
artist: artist.trim(),
|
||||
url,
|
||||
coverId,
|
||||
card,
|
||||
order: 0,
|
||||
type: 'playlist',
|
||||
}
|
||||
})
|
||||
|
||||
tracks.sort((a, b) => b.date.getTime() - a.date.getTime())
|
||||
// assign a stable order after sort (1..N)
|
||||
tracks.forEach((t, i) => (t.order = i + 1))
|
||||
allTracks.push(...tracks)
|
||||
|
||||
return allTracks
|
||||
} catch (error) {
|
||||
return {
|
||||
success: false,
|
||||
error: (error as Error).message
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user