Showing non-showcased batches in latest and upcoming, only meant to be excluded from new.

This commit is contained in:
2026-11-13 22:56:51 +01:00
parent 121d31d325
commit 3645c2a0e6
9 changed files with 37 additions and 10 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import argv from '../src/argv.js';
import { utilsApi } from '../src/manticore.js';
import { syncManticoreActors } from '../src/sync.js';
import runTool from './run-tool.js';
import runTool, { isMain } from './run-tool.js';
export async function rebuildActors() {
await utilsApi.sql('drop table if exists actors');
@@ -33,7 +33,7 @@ export async function rebuildActors() {
await syncManticoreActors();
}
if (import.meta.main) {
if (isMain(import.meta.url)) {
runTool(async () => {
if (argv.update) {
await rebuildActors();
+2 -2
View File
@@ -1,7 +1,7 @@
import argv from '../src/argv.js';
import { utilsApi } from '../src/manticore.js';
import { syncManticoreMovies } from '../src/sync.js';
import runTool from './run-tool.js';
import runTool, { isMain } from './run-tool.js';
export async function rebuildMovies() {
await utilsApi.sql('drop table if exists movies');
@@ -37,7 +37,7 @@ export async function rebuildMovies() {
await syncManticoreMovies();
}
if (import.meta.main) {
if (isMain(import.meta.url)) {
runTool(async () => {
if (argv.update) {
await rebuildMovies();
+3 -2
View File
@@ -1,7 +1,7 @@
import argv from '../src/argv.js';
import { utilsApi } from '../src/manticore.js';
import { syncManticoreScenes } from '../src/sync.js';
import runTool from './run-tool.js';
import runTool, { isMain } from './run-tool.js';
export async function rebuildScenes() {
await utilsApi.sql('drop table if exists scenes');
@@ -40,6 +40,7 @@ export async function rebuildScenes() {
date bigint,
fingerprints text,
is_showcased bool,
is_batch_showcased bool,
created_at bigint,
effective_date bigint,
stashed int,
@@ -62,7 +63,7 @@ export async function rebuildScenes() {
await syncManticoreScenes();
}
if (import.meta.main) {
if (isMain(import.meta.url)) {
runTool(async () => {
if (argv.update) {
await rebuildScenes();
+2 -2
View File
@@ -1,6 +1,6 @@
import { utilsApi } from '../src/manticore.js';
import { syncStashes } from '../src/sync.js';
import runTool from './run-tool.js';
import runTool, { isMain } from './run-tool.js';
export async function rebuildStashes() {
await utilsApi.sql('drop table if exists scenes_stashed');
@@ -37,6 +37,6 @@ export async function rebuildStashes() {
await syncStashes('movie');
}
if (import.meta.main) {
if (isMain(import.meta.url)) {
runTool(rebuildStashes);
}
+16
View File
@@ -1,8 +1,24 @@
import { realpathSync } from 'node:fs';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { knexOwner as knex } from '../src/knex.js';
import redis from '../src/redis.js';
// whether the module was run directly rather than imported, a stand-in for import.meta.main, which needs node 24.2 or 22.18
export function isMain(moduleUrl) {
if (!process.argv[1]) {
return false;
}
try {
return realpathSync(process.argv[1]) === realpathSync(fileURLToPath(moduleUrl));
}
catch (_error) {
return false;
}
}
// runs a command line tool and closes the connections afterwards, the knex pool and redis would otherwise keep the process alive
export default async function runTool(tool) {
try {