diff --git a/scripts/buildAssets/videos.ts b/scripts/buildAssets/videos.ts index 1832e333f..8cb37d045 100644 --- a/scripts/buildAssets/videos.ts +++ b/scripts/buildAssets/videos.ts @@ -6,10 +6,7 @@ import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL'; import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL'; import { toUniqueId } from '../../src/core/blitz/toUniqueId'; import { commitAssets } from '../../src/core/blitzkit/commitAssets'; -import { - VideoDefinitions, - videoDefinitions, -} from '../../src/core/blitzkit/videos'; +import { VideoDefinitions } from '../../src/core/blitzkit/videos'; import { DATA, POI } from './constants'; import { BlitzStrings, botPattern, VehicleDefinitionList } from './definitions'; @@ -21,7 +18,27 @@ const youtubers = [ export async function videos(production: boolean) { console.log('Building videos...'); - const currentVideos = await videoDefinitions; + const currentVideos = await fetch( + 'https://raw.githubusercontent.com/tresabhi/blitzkit-assets/main/definitions/videos.csv', + ) + .then((response) => response.text()) + .then((lines) => { + return lines + .split('\n') + .map((line) => { + const [idString, lastUpdatedString, ...videos] = line.split(','); + const id = Number(idString); + const lastUpdated = Number(lastUpdatedString); + return { id, lastUpdated, videos }; + }) + .reduce( + (accumulator, { id, lastUpdated, videos }) => { + accumulator[id] = { lastUpdated, videos }; + return accumulator; + }, + {}, + ); + }); const auth = await google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/youtube.readonly'], }); @@ -116,6 +133,7 @@ export async function videos(production: boolean) { ) .join('\n'); + return; await commitAssets( 'videos', [{ content, encoding: 'utf-8', path: 'definitions/videos.csv' }],