72 lines
1.5 KiB
JavaScript
72 lines
1.5 KiB
JavaScript
import argv from '../src/argv.js';
|
|
import { utilsApi } from '../src/manticore.js';
|
|
import { syncManticoreScenes } from '../src/sync.js';
|
|
import runTool from './run-tool.js';
|
|
|
|
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');
|
|
|
|
/* 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...');
|
|
|
|
await syncManticoreScenes();
|
|
}
|
|
|
|
if (import.meta.main) {
|
|
runTool(async () => {
|
|
if (argv.update) {
|
|
await rebuildScenes();
|
|
}
|
|
});
|
|
}
|