Files
advcal/pages/api/songs.js
2023-11-30 19:32:58 +01:00

135 lines
3.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { DateTime } = require("luxon");
const SONGS = [
{
"id": "I1Ns-nVULzA",
"title": "Lichterkinder - Guck mal diese Biene da (Offizielles Tanzvideo) | Kinderlied zum Tanzen und Bewegen",
startSeconds: 5,
},
{
"id": "P_37Ht4sph0",
"title": "Ballad of Jesse James Woody Guthrie with Lyrics",
startSeconds: 30,
},
{
"id": "VQbQgdLopd4",
"title": "Made You Look (A Cappella - Official Music Video)"
},
{
"id": "LEvlLtGYPwk",
"title": "Udo Lindenberg & Apache 207 - Komet (Lyric Video)"
},
{
"id": "mz8THYSfzKA",
"title": "👩🏼 Veo Veo - Singen, Tanzen und Bewegen || Kinderlieder"
},
{
"id": "NiTzlyCAxmQ",
"title": "Big Bad Voodoo Daddy Rudolph The Red-Nosed Reindeer"
},
{
"id": "aFD5ZiCdxPw",
"title": "Stu Larsen - We Got Struck By Lightning (Official Video)",
startSeconds: 3
},
{
"id": "40hQeVlkpRI",
"title": "Mambo - Herbert Grönemeyer (official Video)"
},
{
"id": "lIOGZOlm3MI",
"title": "Rainhard Fendrich - Es lebe der Sport (TV/Clip)"
},
{
"id": "Nyo0hhTEb2c",
"title": "Es Schneielet (Ein Deutsches Volkslied)"
},
{
"id": "H10f2w7T5CU",
"title": "My Favourite Time of year - The Florin street Band - Original Christmas Songs"
},
{
"id": "CvBfHwUxHIk",
"title": "Rihanna - Umbrella (Orange Version) (Official Music Video) ft. JAY-Z"
},
{
"id": "4F_RCWVoL4s",
"title": "Neil Diamond - Sweet Caroline (Audio)"
},
{
"id": "5u7rdTFGNIk",
"title": "Anna am Klavier",
startSeconds: 12.5,
endSeconds: 72.4,
},
{
"id": "CVyJkKKfRFs",
"title": "Melbourne Ska Orchestra - Get Smart (Official FULL Version)",
startSeconds: 47
},
{
"id": "rylbj33b8qA",
"title": "Amy Winehouse - Monkey Man",
startSeconds: 4
},
{
"id": "a3O-PLopk5g",
"title": "Max Raabe - We Will Rock You"
},
{
"id": "-8ZqhPtlXpM",
"title": "Zaz - La pluie"
},
{
"id": "5Fqhr01L7wE",
"title": "Jacob on the trumpet",
startSeconds: 1.4,
endSeconds: 35,
},
{
"id": "vKUDSgUFWMA",
"title": "[Minion] Joe Dassin Champs Elysées"
},
{
"id": "0GcPYzYYM9M",
"title": "The New Vaudeville Band - Winchester Cathedral (1966)"
},
{
"id": "YuBeBjqKSGQ",
"title": "The Magic Flute Queen of the Night aria (Mozart; Diana Damrau, The Royal Opera)"
},
{
"id": "T-r8wV_29KE",
"title": "Max Raabe - J'Attendrai",
startSeconds: 20,
},
{
"id": "Mp7zZNhS8Oo",
"title": "Lali on the trumpet",
startSeconds: 3,
}
];
export default async function getSongs(req, res) {
const unlocked = req.query.unlock === 'true';
const NOW = DateTime.utc().setZone("Europe/Berlin");
const getLockedData = (index) => {
const dayString = ("00" + (index + 1)).substr(-2, 2);
const lockedUntilDateTime = DateTime.fromISO(
`${NOW.year}-12-${dayString}T00:00:00.000+01:00`
);
return {
locked: unlocked ? false : NOW < lockedUntilDateTime,
lockedUntil: lockedUntilDateTime.toISO(),
};
};
const songs = SONGS.map((item, index) => ({
...item,
...getLockedData(index),
}));
res.json({ songs });
};