Compare commits

...

2 Commits

Author SHA1 Message Date
DebaucheryLibrarian
6449fceef3 1.247.1 2026-01-26 02:14:20 +01:00
DebaucheryLibrarian
36ba4542a6 Added batch ID and better feedback to StashDB import tool. 2026-01-26 02:14:18 +01:00
4 changed files with 17 additions and 6 deletions

View File

@@ -42,6 +42,11 @@ exports.up = async (knex) => {
table.integer('source_submissions');
table.json('source_meta');
table.integer('batch_id')
.notNullable()
.references('id')
.inTable('batches');
table.datetime('source_created_at');
table.datetime('created_at')

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "traxxx",
"version": "1.247.0",
"version": "1.247.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "traxxx",
"version": "1.247.0",
"version": "1.247.1",
"license": "ISC",
"dependencies": {
"@aws-sdk/client-s3": "^3.458.0",

View File

@@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.247.0",
"version": "1.247.1",
"description": "All the latest porn releases in one place",
"main": "src/app.js",
"scripts": {

View File

@@ -1,6 +1,6 @@
'use strict';
const util = require('util');
// const util = require('util');
const unprint = require('unprint');
const args = require('yargs').argv;
@@ -79,7 +79,10 @@ async function curateData(data) {
return release;
});
console.log(`Found ${stashScenes.length} scenes in StashDB`);
const stashScenesByIdentifiers = Object.fromEntries(stashScenes.flatMap((scene) => [[scene.entryId || scene.urlId, scene], [scene.url, scene]]));
const [{ id: batchId }] = await knex('batches').insert({ showcased: false, comment: 'StashDB fingerprints' }).returning('id');
const sceneEntries = await knex('releases')
.select('releases.*')
@@ -88,6 +91,8 @@ async function curateData(data) {
.where('entities.slug', 'hardx')
.whereIn('entry_id', stashScenes.map((scene) => scene.entryId || scene.urlId));
console.log(`Matched ${sceneEntries.length} scenes`);
const fpEntries = sceneEntries.flatMap((scene) => {
const stashScene = stashScenesByIdentifiers[scene.entry_id]
|| stashScenesByIdentifiers[scene.url];
@@ -108,15 +113,16 @@ async function curateData(data) {
url: stashScene.url,
date: stashScene.date,
},
batch_id: batchId,
}));
});
console.log(util.inspect(fpEntries, { colors: true, depth: null, maxArrayLength: null }));
// console.log(util.inspect(fpEntries, { colors: true, depth: null, maxArrayLength: null }));
if (args.update) {
await bulkInsert('releases_fingerprints', fpEntries, false);
console.log(`Inserted ${fpEntries.length} hash entries`);
console.log(`Inserted ${fpEntries.length} hash entries in batch ${batchId}`);
}
}