Added manticore sync all tool, updated manticore driver.

This commit is contained in:
2026-11-12 02:18:13 +01:00
parent de05075def
commit f5e3a8a2ae
7 changed files with 175 additions and 151 deletions
+38 -40
View File
@@ -1,48 +1,46 @@
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';
import runTool from './run-tool.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
)`);
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...');
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
await syncManticoreMovies();
}
init();
if (import.meta.main) {
runTool(async () => {
if (argv.update) {
await rebuildMovies();
}
});
}