import argv from '../src/argv.js'; import { knexOwner as knex } from '../src/knex.js'; import { utilsApi } from '../src/manticore.js'; import redis from '../src/redis.js'; import { syncManticoreMovies } from '../src/sync.js'; async function init() { if (argv.update) { 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...'); const data = await syncManticoreMovies(); console.log('data', data); } await knex.destroy(); await redis.quit(); // sync imports connect to redis, which keeps the process alive } init();