fix: use production videos

This commit is contained in:
TrèsAbhi committed 2024-04-25 14:00:00 -05:00
1 parent b1917c73f2
commit c30358248f
1 file changed
+23 -5
+23 -5
View File
@@ -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<VideoDefinitions>(
(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' }],