Added manticore sync all tool, updated manticore driver.
This commit is contained in:
+61
-61
@@ -1,71 +1,71 @@
|
||||
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 { syncManticoreScenes } from '../src/sync.js';
|
||||
import runTool from './run-tool.js';
|
||||
|
||||
async function init() {
|
||||
if (argv.update) {
|
||||
await utilsApi.sql('drop table if exists scenes');
|
||||
// bigint rather than timestamp, which is unsigned 32-bit and wraps dates before 1970 into the 2100s
|
||||
await utilsApi.sql(`create table scenes (
|
||||
id int,
|
||||
title text,
|
||||
title_filtered text,
|
||||
entry_id text,
|
||||
shoot_id text,
|
||||
channel_id int,
|
||||
channel_name text,
|
||||
channel_slug text,
|
||||
network_id int,
|
||||
network_name text,
|
||||
network_slug text,
|
||||
studio_id int,
|
||||
studio_name text,
|
||||
studio_slug text,
|
||||
entity_ids multi,
|
||||
actor_ids multi,
|
||||
actors text,
|
||||
actor_count int,
|
||||
female_count int,
|
||||
male_count int,
|
||||
trans_count int,
|
||||
unidentified_count int,
|
||||
tag_ids multi,
|
||||
assigned_tag_ids multi64,
|
||||
tags text,
|
||||
movie_ids multi,
|
||||
movies text,
|
||||
serie_ids multi,
|
||||
series text,
|
||||
meta text,
|
||||
date bigint,
|
||||
fingerprints text,
|
||||
is_showcased bool,
|
||||
created_at bigint,
|
||||
effective_date bigint,
|
||||
stashed int,
|
||||
dupe_index int
|
||||
)`);
|
||||
export async function rebuildScenes() {
|
||||
await utilsApi.sql('drop table if exists scenes');
|
||||
// bigint rather than timestamp, which is unsigned 32-bit and wraps dates before 1970 into the 2100s
|
||||
await utilsApi.sql(`create table scenes (
|
||||
id int,
|
||||
title text,
|
||||
title_filtered text,
|
||||
entry_id text,
|
||||
shoot_id text,
|
||||
channel_id int,
|
||||
channel_name text,
|
||||
channel_slug text,
|
||||
network_id int,
|
||||
network_name text,
|
||||
network_slug text,
|
||||
studio_id int,
|
||||
studio_name text,
|
||||
studio_slug text,
|
||||
entity_ids multi,
|
||||
actor_ids multi,
|
||||
actors text,
|
||||
actor_count int,
|
||||
female_count int,
|
||||
male_count int,
|
||||
trans_count int,
|
||||
unidentified_count int,
|
||||
tag_ids multi,
|
||||
assigned_tag_ids multi64,
|
||||
tags text,
|
||||
movie_ids multi,
|
||||
movies text,
|
||||
serie_ids multi,
|
||||
series text,
|
||||
meta text,
|
||||
date bigint,
|
||||
fingerprints text,
|
||||
is_showcased bool,
|
||||
created_at bigint,
|
||||
effective_date bigint,
|
||||
stashed int,
|
||||
dupe_index int
|
||||
)`);
|
||||
|
||||
await utilsApi.sql('drop table if exists scenes_tags');
|
||||
await utilsApi.sql('drop table if exists scenes_tags');
|
||||
|
||||
/* legacy, using packed decimal keys now
|
||||
await utilsApi.sql(`create table scenes_tags (
|
||||
id int,
|
||||
scene_id int,
|
||||
tag_id int,
|
||||
actor_id int
|
||||
)`);
|
||||
*/
|
||||
/* legacy, using packed decimal keys now
|
||||
await utilsApi.sql(`create table scenes_tags (
|
||||
id int,
|
||||
scene_id int,
|
||||
tag_id int,
|
||||
actor_id int
|
||||
)`);
|
||||
*/
|
||||
|
||||
console.log('Recreated scenes tables, syncing scenes...');
|
||||
console.log('Recreated scenes tables, syncing scenes...');
|
||||
|
||||
await syncManticoreScenes();
|
||||
}
|
||||
|
||||
await knex.destroy();
|
||||
await redis.quit(); // sync imports connect to redis, which keeps the process alive
|
||||
await syncManticoreScenes();
|
||||
}
|
||||
|
||||
init();
|
||||
if (import.meta.main) {
|
||||
runTool(async () => {
|
||||
if (argv.update) {
|
||||
await rebuildScenes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user