feat: videos

This commit is contained in:
TrèsAbhi committed 2024-04-20 21:01:28 -05:00
1 parent 0fd17d9c96
commit dd41cac3ac
3 files changed
+81 -2

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
import { asset } from './asset';
export const videoDefinitions = fetch(asset('definitions/videos.csv'))
.then((response) => response.text())
.then((text) =>
text
.split('\n')
.map((line) => {
const [idString, ...videos] = line.split(',');
const id = Number(idString);
return { id, videos };
})
.filter(({ videos }) => videos.length > 0)
.reduce<Record<number, string[]>>((accumulator, { id, videos }) => {
accumulator[id] = videos;
return accumulator;
}, {}),
);