Portage complet PHP/Bash vers Node.js (Fastify + worker_threads)
This commit is contained in:
59
cron/runAll.js
Normal file
59
cron/runAll.js
Normal file
@@ -0,0 +1,59 @@
|
||||
// Port of cron.sh + tmdbintegral/tmdbintegral.sh
|
||||
//
|
||||
// Pipeline:
|
||||
// 1. Refresh imdbratings.tsv
|
||||
// 2. Download daily TMDb exports (movie.json, tv.json)
|
||||
// 3. In parallel: tmdbSync(movie+tv), justwatchSync(movie+tv)
|
||||
// 4. In parallel: tmdb2imdb(movie+tv), buildSearch(movie+tv)
|
||||
// 5. In parallel: ambiguity(movie+tv)
|
||||
//
|
||||
// Writes cron.txt at start/end (mirrors cron.sh).
|
||||
|
||||
import { writeFileSync, appendFileSync } from 'node:fs';
|
||||
import { CRON_TXT } from '../config.js';
|
||||
import { syncImdbRatings } from './imdbRatings.js';
|
||||
import { syncExports } from './tmdbExports.js';
|
||||
import { syncType as syncTmdb } from './tmdbSync.js';
|
||||
import { syncType as syncJustwatch } from './justwatchSync.js';
|
||||
import { buildMapping } from './tmdb2imdb.js';
|
||||
import { buildSearch } from './buildSearch.js';
|
||||
import { buildAmbiguity } from './ambiguity.js';
|
||||
|
||||
function dateStamp() {
|
||||
return new Date().toString();
|
||||
}
|
||||
|
||||
export async function runAll() {
|
||||
writeFileSync(CRON_TXT, `Started At ${dateStamp()}\n`);
|
||||
|
||||
await syncImdbRatings();
|
||||
await syncExports();
|
||||
|
||||
await Promise.all([
|
||||
syncTmdb('movie'),
|
||||
syncTmdb('tv'),
|
||||
syncJustwatch('movie'),
|
||||
syncJustwatch('tv'),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
buildMapping('movie'),
|
||||
buildMapping('tv'),
|
||||
buildSearch('movie'),
|
||||
buildSearch('tv'),
|
||||
]);
|
||||
|
||||
await Promise.all([
|
||||
buildAmbiguity('movie'),
|
||||
buildAmbiguity('tv'),
|
||||
]);
|
||||
|
||||
appendFileSync(CRON_TXT, `Finished At ${dateStamp()}\n`);
|
||||
}
|
||||
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
runAll().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user