import argv from '../src/argv.js'; import { utilsApi } from '../src/manticore.js'; import { syncManticoreMovies } from '../src/sync.js'; import runTool from './run-tool.js'; export async function rebuildMovies() { await utilsApi.sql('drop table if exists movies'); // bigint rather than timestamp, which is unsigned 32-bit and wraps dates before 1970 into the 2100s await utilsApi.sql(`create table movies ( id int, title text, title_filtered text, channel_id int, channel_name text, channel_slug text, network_id int, network_name text, network_slug text, entity_ids multi, actor_ids multi, actors text, tag_ids multi, tags text, meta text, date bigint, has_cover bool, created_at bigint, effective_date bigint, stashed int, stashed_scenes int, stashed_total int, dupe_index int )`); console.log('Recreated movies tables, syncing movies...'); await syncManticoreMovies(); } if (import.meta.main) { runTool(async () => { if (argv.update) { await rebuildMovies(); } }); }