Compare commits
No commits in common. "31e884359ec84331f263d46bc8950af0f36f50b5" and "ae2d3591ee31e3d7c67415fc6c54717bb921a065" have entirely different histories.
31e884359e
...
ae2d3591ee
|
@ -68,9 +68,6 @@ module.exports = {
|
||||||
usernameLength: [2, 24],
|
usernameLength: [2, 24],
|
||||||
usernamePattern: /^[a-zA-Z0-9_-]+$/,
|
usernamePattern: /^[a-zA-Z0-9_-]+$/,
|
||||||
},
|
},
|
||||||
stashes: {
|
|
||||||
viewRefreshCooldown: 60, // minutes
|
|
||||||
},
|
|
||||||
exclude: {
|
exclude: {
|
||||||
channels: [
|
channels: [
|
||||||
// 21sextreme, no longer updated
|
// 21sextreme, no longer updated
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Puppeteer
|
|
||||||
Puppeteer has several dependencies that may not be available in Debian 12 by default:
|
|
||||||
|
|
||||||
`apt install libasound2 libatk-bridge2.0-0 libcairo2 libcups2 libdrm2 libgbm-dev libpango-1.0-0 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon-x11-0 libxrandr2 `
|
|
|
@ -1,34 +0,0 @@
|
||||||
exports.up = async function up(knex) {
|
|
||||||
await knex.raw(`
|
|
||||||
CREATE MATERIALIZED VIEW actors_meta AS (
|
|
||||||
SELECT
|
|
||||||
actors.*,
|
|
||||||
COUNT(DISTINCT stashes_actors) as stashed,
|
|
||||||
COUNT(DISTINCT releases_actors) as scenes,
|
|
||||||
row_to_json(avatars) as avatar
|
|
||||||
FROM actors
|
|
||||||
LEFT JOIN stashes_actors ON stashes_actors.actor_id = actors.id
|
|
||||||
LEFT JOIN releases_actors ON releases_actors.actor_id = actors.id
|
|
||||||
LEFT JOIN media AS avatars ON avatars.id = actors.avatar_media_id
|
|
||||||
GROUP BY
|
|
||||||
actors.id,
|
|
||||||
avatars.id
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE MATERIALIZED VIEW scenes_meta AS (
|
|
||||||
SELECT
|
|
||||||
releases.*,
|
|
||||||
COUNT(DISTINCT stashes_scenes) as stashed
|
|
||||||
FROM releases
|
|
||||||
LEFT JOIN stashes_scenes ON stashes_scenes.scene_id = releases.id
|
|
||||||
GROUP BY releases.id
|
|
||||||
);
|
|
||||||
`);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.down = async function down(knex) {
|
|
||||||
await knex.raw(`
|
|
||||||
DROP MATERIALIZED VIEW IF EXISTS actors_meta;
|
|
||||||
DROP MATERIALIZED VIEW IF EXISTS scenes_meta;
|
|
||||||
`);
|
|
||||||
};
|
|
|
@ -1,35 +0,0 @@
|
||||||
const config = require('config');
|
|
||||||
const manticore = require('manticoresearch');
|
|
||||||
|
|
||||||
const mantiClient = new manticore.ApiClient();
|
|
||||||
|
|
||||||
mantiClient.basePath = `http://${config.database.manticore.host}:${config.database.manticore.httpPort}`;
|
|
||||||
|
|
||||||
const utilsApi = new manticore.UtilsApi(mantiClient);
|
|
||||||
|
|
||||||
exports.up = async () => {
|
|
||||||
await utilsApi.sql(`create table scenes (
|
|
||||||
id int,
|
|
||||||
title text,
|
|
||||||
entry_id text,
|
|
||||||
channel_id int,
|
|
||||||
channel_name text,
|
|
||||||
channel_slug text,
|
|
||||||
network_id int,
|
|
||||||
network_name text,
|
|
||||||
network_slug text,
|
|
||||||
actor_ids multi,
|
|
||||||
actors text,
|
|
||||||
tag_ids multi,
|
|
||||||
tags text,
|
|
||||||
meta text,
|
|
||||||
date timestamp,
|
|
||||||
created_at timestamp,
|
|
||||||
effective_date timestamp,
|
|
||||||
stashed int
|
|
||||||
)`);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.down = async () => {
|
|
||||||
await utilsApi.sql('drop table scenes');
|
|
||||||
};
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.236.0",
|
"version": "1.235.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.236.0",
|
"version": "1.235.5",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.458.0",
|
"@aws-sdk/client-s3": "^3.458.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.236.0",
|
"version": "1.235.5",
|
||||||
"description": "All the latest porn releases in one place",
|
"description": "All the latest porn releases in one place",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 90 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 37 KiB |
|
@ -1085,8 +1085,8 @@ const tags = [
|
||||||
slug: 'toys',
|
slug: 'toys',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'anal toy',
|
name: 'toy anal',
|
||||||
slug: 'anal-toy',
|
slug: 'toy-anal',
|
||||||
description: 'Stuffing a toy, such as a dildo or buttplug, into the ass',
|
description: 'Stuffing a toy, such as a dildo or buttplug, into the ass',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1359,8 +1359,8 @@ const aliases = [
|
||||||
secondary: true,
|
secondary: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'mmf',
|
name: 'mfm',
|
||||||
for: 'mfm',
|
for: 'mmf',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'fmf',
|
name: 'fmf',
|
||||||
|
@ -1499,22 +1499,18 @@ const aliases = [
|
||||||
name: 'brunettes',
|
name: 'brunettes',
|
||||||
for: 'brunette',
|
for: 'brunette',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'anal toys',
|
|
||||||
for: 'anal-toy',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'buttplug',
|
name: 'buttplug',
|
||||||
for: 'anal-toy',
|
for: 'anal-toys',
|
||||||
secondary: true,
|
secondary: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'butt plug',
|
name: 'butt plug',
|
||||||
for: 'anal-toy',
|
for: 'anal-toys',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'butt plugs',
|
name: 'butt plugs',
|
||||||
for: 'anal-toy',
|
for: 'anal-toys',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'caning',
|
name: 'caning',
|
||||||
|
@ -2434,7 +2430,7 @@ const aliases = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'strip pole dancing',
|
name: 'strip pole dancing',
|
||||||
for: 'pole-dancing',
|
for: 'strip-pole-dancing',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'anal gangbangs',
|
name: 'anal gangbangs',
|
||||||
|
|
|
@ -433,7 +433,6 @@ const networks = [
|
||||||
name: 'Kink Men',
|
name: 'Kink Men',
|
||||||
url: 'https://www.kinkmen.com',
|
url: 'https://www.kinkmen.com',
|
||||||
parent: 'kink',
|
parent: 'kink',
|
||||||
tags: ['gay'],
|
|
||||||
parameters: {
|
parameters: {
|
||||||
interval: 1000,
|
interval: 1000,
|
||||||
concurrency: 1,
|
concurrency: 1,
|
||||||
|
|
|
@ -2955,32 +2955,11 @@ const sites = [
|
||||||
parent: 'digitalplayground',
|
parent: 'digitalplayground',
|
||||||
},
|
},
|
||||||
// DFXTRA DOGFART NETWORK
|
// DFXTRA DOGFART NETWORK
|
||||||
{
|
|
||||||
slug: 'dfxtra',
|
|
||||||
name: 'DFXtra',
|
|
||||||
url: 'https://www.dfxtra.com',
|
|
||||||
parent: 'dfxtra',
|
|
||||||
parameters: {
|
|
||||||
layout: 'api',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
slug: 'dfxtraoriginals',
|
slug: 'dfxtraoriginals',
|
||||||
name: 'DFXtra Originals',
|
name: 'DFXtra Originals',
|
||||||
url: 'https://www.dfxtra.com',
|
url: 'https://www.dfxtra.com',
|
||||||
parent: 'dfxtra',
|
parent: 'dogfartnetwork',
|
||||||
parameters: {
|
|
||||||
layout: 'api',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
slug: 'dfxtracompilations',
|
|
||||||
name: 'DFXtra Compilations',
|
|
||||||
url: 'https://www.dfxtra.com',
|
|
||||||
parent: 'dfxtra',
|
|
||||||
parameters: {
|
|
||||||
layout: 'api',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slug: 'blacksonblondes',
|
slug: 'blacksonblondes',
|
||||||
|
|
|
@ -1074,7 +1074,6 @@ async function associatePeople(releases, batchId, type = 'actor') {
|
||||||
}
|
}
|
||||||
|
|
||||||
await bulkInsert(`releases_${type}`, validReleaseActorAssociations, false);
|
await bulkInsert(`releases_${type}`, validReleaseActorAssociations, false);
|
||||||
await knex.schema.refreshMaterializedView('actors_meta');
|
|
||||||
|
|
||||||
logger.verbose(`Associated ${releaseActorAssociations.length} actors to ${releases.length} scenes`);
|
logger.verbose(`Associated ${releaseActorAssociations.length} actors to ${releases.length} scenes`);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const config = require('config');
|
|
||||||
|
|
||||||
const knex = require('./knex');
|
const knex = require('./knex');
|
||||||
const { HttpError } = require('./errors');
|
const { HttpError } = require('./errors');
|
||||||
const slugify = require('./utils/slugify');
|
const slugify = require('./utils/slugify');
|
||||||
const logger = require('./logger')(__filename);
|
|
||||||
|
|
||||||
let lastActorsViewRefresh = 0;
|
|
||||||
|
|
||||||
function curateStash(stash) {
|
function curateStash(stash) {
|
||||||
if (!stash) {
|
if (!stash) {
|
||||||
|
@ -124,21 +119,6 @@ async function removeStash(stashId, sessionUser) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshActorsView() {
|
|
||||||
if (new Date() - lastActorsViewRefresh > config.stashes.viewRefreshCooldown * 60000) {
|
|
||||||
// don't refresh actors view more than once an hour
|
|
||||||
lastActorsViewRefresh = new Date();
|
|
||||||
|
|
||||||
logger.debug('Refreshing actors view');
|
|
||||||
|
|
||||||
return knex.schema.refreshMaterializedView('actors_meta');
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.silly('Skipping actors view refresh');
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function stashActor(actorId, stashId, sessionUser) {
|
async function stashActor(actorId, stashId, sessionUser) {
|
||||||
const stash = await fetchStash(stashId, sessionUser);
|
const stash = await fetchStash(stashId, sessionUser);
|
||||||
|
|
||||||
|
@ -148,8 +128,6 @@ async function stashActor(actorId, stashId, sessionUser) {
|
||||||
actor_id: actorId,
|
actor_id: actorId,
|
||||||
});
|
});
|
||||||
|
|
||||||
refreshActorsView();
|
|
||||||
|
|
||||||
return fetchStashes('actor', actorId, sessionUser);
|
return fetchStashes('actor', actorId, sessionUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +166,6 @@ async function unstashActor(actorId, stashId, sessionUser) {
|
||||||
.where('stashes.user_id', sessionUser.id))
|
.where('stashes.user_id', sessionUser.id))
|
||||||
.delete();
|
.delete();
|
||||||
|
|
||||||
refreshActorsView();
|
|
||||||
|
|
||||||
return fetchStashes('actor', actorId, sessionUser);
|
return fetchStashes('actor', actorId, sessionUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,9 @@ const update = args.update;
|
||||||
async function fetchActors() {
|
async function fetchActors() {
|
||||||
// manually select date of birth, otherwise it is retrieved in local timezone but interpreted as UTC...
|
// manually select date of birth, otherwise it is retrieved in local timezone but interpreted as UTC...
|
||||||
const actors = await knex.raw(`
|
const actors = await knex.raw(`
|
||||||
SELECT
|
SELECT actors.*, date_of_birth AT TIME ZONE 'Europe/Amsterdam' AT TIME ZONE 'UTC' as dob
|
||||||
actors_meta.*,
|
FROM actors
|
||||||
date_of_birth AT TIME ZONE 'Europe/Amsterdam' AT TIME ZONE 'UTC' as dob
|
GROUP BY actors.id;
|
||||||
FROM actors_meta;
|
|
||||||
`);
|
`);
|
||||||
|
|
||||||
return actors.rows;
|
return actors.rows;
|
||||||
|
@ -45,9 +44,7 @@ async function init() {
|
||||||
cup string,
|
cup string,
|
||||||
natural_boobs int,
|
natural_boobs int,
|
||||||
penis_length int,
|
penis_length int,
|
||||||
penis_girth int,
|
penis_girth int
|
||||||
stashed int,
|
|
||||||
scenes int
|
|
||||||
)`);
|
)`);
|
||||||
|
|
||||||
const actors = await fetchActors();
|
const actors = await fetchActors();
|
||||||
|
@ -69,8 +66,6 @@ async function init() {
|
||||||
natural_boobs: actor.natural_boobs === null ? 0 : Number(actor.natural_boobs) + 1, // manticore bool does not seem to support null, and we need three states for natural_boobs: yes, no and unknown
|
natural_boobs: actor.natural_boobs === null ? 0 : Number(actor.natural_boobs) + 1, // manticore bool does not seem to support null, and we need three states for natural_boobs: yes, no and unknown
|
||||||
penis_length: actor.penis_length || undefined,
|
penis_length: actor.penis_length || undefined,
|
||||||
penis_girth: actor.penis_girth || undefined,
|
penis_girth: actor.penis_girth || undefined,
|
||||||
stashed: actor.stashed || 0,
|
|
||||||
scenes: actor.scenes || 0,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -20,12 +20,11 @@ const update = args.update;
|
||||||
async function fetchScenes() {
|
async function fetchScenes() {
|
||||||
const scenes = await knex.raw(`
|
const scenes = await knex.raw(`
|
||||||
SELECT
|
SELECT
|
||||||
scenes_meta.id AS id,
|
releases.id AS id,
|
||||||
scenes_meta.title,
|
releases.title,
|
||||||
scenes_meta.created_at,
|
releases.created_at,
|
||||||
scenes_meta.date,
|
releases.date,
|
||||||
scenes_meta.entry_id,
|
releases.entry_id,
|
||||||
scenes_meta.stashed,
|
|
||||||
entities.id as channel_id,
|
entities.id as channel_id,
|
||||||
entities.slug as channel_slug,
|
entities.slug as channel_slug,
|
||||||
entities.name as channel_name,
|
entities.name as channel_name,
|
||||||
|
@ -34,31 +33,17 @@ async function fetchScenes() {
|
||||||
parents.name as network_name,
|
parents.name as network_name,
|
||||||
COALESCE(JSON_AGG(DISTINCT (actors.id, actors.name)) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors,
|
COALESCE(JSON_AGG(DISTINCT (actors.id, actors.name)) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors,
|
||||||
COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags
|
COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags
|
||||||
FROM scenes_meta
|
FROM releases
|
||||||
LEFT JOIN entities ON scenes_meta.entity_id = entities.id
|
LEFT JOIN entities ON releases.entity_id = entities.id
|
||||||
LEFT JOIN entities AS parents ON parents.id = entities.parent_id
|
LEFT JOIN entities AS parents ON parents.id = entities.parent_id
|
||||||
LEFT JOIN releases_actors AS local_actors ON local_actors.release_id = scenes_meta.id
|
LEFT JOIN releases_actors AS local_actors ON local_actors.release_id = releases.id
|
||||||
LEFT JOIN releases_directors AS local_directors ON local_directors.release_id = scenes_meta.id
|
LEFT JOIN releases_directors AS local_directors ON local_directors.release_id = releases.id
|
||||||
LEFT JOIN releases_tags AS local_tags ON local_tags.release_id = scenes_meta.id
|
LEFT JOIN releases_tags AS local_tags ON local_tags.release_id = releases.id
|
||||||
LEFT JOIN actors ON local_actors.actor_id = actors.id
|
LEFT JOIN actors ON local_actors.actor_id = actors.id
|
||||||
LEFT JOIN actors AS directors ON local_directors.director_id = directors.id
|
LEFT JOIN actors AS directors ON local_directors.director_id = directors.id
|
||||||
LEFT JOIN tags ON local_tags.tag_id = tags.id AND tags.priority >= 6
|
LEFT JOIN tags ON local_tags.tag_id = tags.id AND tags.priority >= 6
|
||||||
LEFT JOIN tags as tags_aliases ON local_tags.tag_id = tags_aliases.alias_for AND tags_aliases.secondary = true
|
LEFT JOIN tags as tags_aliases ON local_tags.tag_id = tags_aliases.alias_for AND tags_aliases.secondary = true
|
||||||
GROUP BY
|
GROUP BY releases.id, entities.id, entities.name, entities.slug, entities.alias, parents.id, parents.name, parents.slug, parents.alias;
|
||||||
scenes_meta.id,
|
|
||||||
scenes_meta.title,
|
|
||||||
scenes_meta.created_at,
|
|
||||||
scenes_meta.date,
|
|
||||||
scenes_meta.entry_id,
|
|
||||||
scenes_meta.stashed,
|
|
||||||
entities.id,
|
|
||||||
entities.name,
|
|
||||||
entities.slug,
|
|
||||||
entities.alias,
|
|
||||||
parents.id,
|
|
||||||
parents.name,
|
|
||||||
parents.slug,
|
|
||||||
parents.alias;
|
|
||||||
`);
|
`);
|
||||||
|
|
||||||
return scenes.rows;
|
return scenes.rows;
|
||||||
|
@ -81,17 +66,15 @@ async function init() {
|
||||||
actors text,
|
actors text,
|
||||||
tag_ids multi,
|
tag_ids multi,
|
||||||
tags text,
|
tags text,
|
||||||
meta text,
|
|
||||||
date timestamp,
|
date timestamp,
|
||||||
created_at timestamp,
|
created_at timestamp,
|
||||||
effective_date timestamp,
|
effective_date timestamp
|
||||||
stashed int
|
|
||||||
)`);
|
)`);
|
||||||
|
|
||||||
const scenes = await fetchScenes();
|
const scenes = await fetchScenes();
|
||||||
|
|
||||||
const docs = scenes.map((scene) => ({
|
const docs = scenes.map((scene) => ({
|
||||||
replace: {
|
insert: {
|
||||||
index: 'scenes',
|
index: 'scenes',
|
||||||
id: scene.id,
|
id: scene.id,
|
||||||
doc: {
|
doc: {
|
||||||
|
@ -110,7 +93,6 @@ async function init() {
|
||||||
actors: scene.actors.map((actor) => actor.f2).join(),
|
actors: scene.actors.map((actor) => actor.f2).join(),
|
||||||
tag_ids: scene.tags.map((tag) => tag.f1),
|
tag_ids: scene.tags.map((tag) => tag.f1),
|
||||||
tags: scene.tags.map((tag) => tag.f2).join(),
|
tags: scene.tags.map((tag) => tag.f2).join(),
|
||||||
stashed: scene.stashed || 0,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -1,94 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const manticore = require('manticoresearch');
|
|
||||||
const { format } = require('date-fns');
|
|
||||||
|
|
||||||
const knex = require('./knex');
|
const knex = require('./knex');
|
||||||
const logger = require('./logger')(__filename);
|
const logger = require('./logger')(__filename);
|
||||||
const bulkInsert = require('./utils/bulk-insert');
|
const bulkInsert = require('./utils/bulk-insert');
|
||||||
|
|
||||||
const mantiClient = new manticore.ApiClient();
|
async function updateSceneSearch(releaseIds) {
|
||||||
const indexApi = new manticore.IndexApi(mantiClient);
|
|
||||||
|
|
||||||
async function updateManticoreSearch(releaseIds) {
|
|
||||||
const scenes = await knex.raw(`
|
|
||||||
SELECT
|
|
||||||
scenes_meta.id AS id,
|
|
||||||
scenes_meta.title,
|
|
||||||
scenes_meta.created_at,
|
|
||||||
scenes_meta.date,
|
|
||||||
scenes_meta.entry_id,
|
|
||||||
scenes_meta.stashed,
|
|
||||||
entities.id as channel_id,
|
|
||||||
entities.slug as channel_slug,
|
|
||||||
entities.name as channel_name,
|
|
||||||
parents.id as network_id,
|
|
||||||
parents.slug as network_slug,
|
|
||||||
parents.name as network_name,
|
|
||||||
COALESCE(JSON_AGG(DISTINCT (actors.id, actors.name)) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors,
|
|
||||||
COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags
|
|
||||||
FROM scenes_meta
|
|
||||||
LEFT JOIN entities ON scenes_meta.entity_id = entities.id
|
|
||||||
LEFT JOIN entities AS parents ON parents.id = entities.parent_id
|
|
||||||
LEFT JOIN releases_actors AS local_actors ON local_actors.release_id = scenes_meta.id
|
|
||||||
LEFT JOIN releases_directors AS local_directors ON local_directors.release_id = scenes_meta.id
|
|
||||||
LEFT JOIN releases_tags AS local_tags ON local_tags.release_id = scenes_meta.id
|
|
||||||
LEFT JOIN actors ON local_actors.actor_id = actors.id
|
|
||||||
LEFT JOIN actors AS directors ON local_directors.director_id = directors.id
|
|
||||||
LEFT JOIN tags ON local_tags.tag_id = tags.id AND tags.priority >= 6
|
|
||||||
LEFT JOIN tags as tags_aliases ON local_tags.tag_id = tags_aliases.alias_for AND tags_aliases.secondary = true
|
|
||||||
${releaseIds ? 'WHERE scenes_meta.id = ANY(?)' : ''}
|
|
||||||
GROUP BY
|
|
||||||
scenes_meta.id,
|
|
||||||
scenes_meta.title,
|
|
||||||
scenes_meta.created_at,
|
|
||||||
scenes_meta.date,
|
|
||||||
scenes_meta.entry_id,
|
|
||||||
scenes_meta.stashed,
|
|
||||||
entities.id,
|
|
||||||
entities.name,
|
|
||||||
entities.slug,
|
|
||||||
entities.alias,
|
|
||||||
parents.id,
|
|
||||||
parents.name,
|
|
||||||
parents.slug,
|
|
||||||
parents.alias;
|
|
||||||
`, releaseIds && [releaseIds]);
|
|
||||||
|
|
||||||
const docs = scenes.rows.map((scene) => ({
|
|
||||||
replace: {
|
|
||||||
index: 'scenes',
|
|
||||||
id: scene.id,
|
|
||||||
doc: {
|
|
||||||
title: scene.title || undefined,
|
|
||||||
date: scene.date ? Math.round(scene.date.getTime() / 1000) : undefined,
|
|
||||||
created_at: Math.round(scene.created_at.getTime() / 1000),
|
|
||||||
effective_date: Math.round((scene.date || scene.created_at).getTime() / 1000),
|
|
||||||
entry_id: scene.entry_id,
|
|
||||||
channel_id: scene.channel_id,
|
|
||||||
channel_slug: scene.channel_slug,
|
|
||||||
channel_name: scene.channel_name,
|
|
||||||
network_id: scene.network_id || undefined,
|
|
||||||
network_slug: scene.network_slug || undefined,
|
|
||||||
network_name: scene.network_name || undefined,
|
|
||||||
actor_ids: scene.actors.map((actor) => actor.f1),
|
|
||||||
actors: scene.actors.map((actor) => actor.f2).join(),
|
|
||||||
tag_ids: scene.tags.map((tag) => tag.f1),
|
|
||||||
tags: scene.tags.map((tag) => tag.f2).join(),
|
|
||||||
meta: scene.date ? format(scene.date, 'y M d') : undefined,
|
|
||||||
stashed: scene.stashed || 0,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (docs.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await indexApi.bulk(docs.map((doc) => JSON.stringify(doc)).join('\n'));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateSqlSearch(releaseIds) {
|
|
||||||
logger.info(`Updating search documents for ${releaseIds ? releaseIds.length : 'all' } releases`);
|
logger.info(`Updating search documents for ${releaseIds ? releaseIds.length : 'all' } releases`);
|
||||||
|
|
||||||
const documents = await knex.raw(`
|
const documents = await knex.raw(`
|
||||||
|
@ -132,13 +48,6 @@ async function updateSqlSearch(releaseIds) {
|
||||||
await knex.raw('REFRESH MATERIALIZED VIEW releases_summaries;');
|
await knex.raw('REFRESH MATERIALIZED VIEW releases_summaries;');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateSceneSearch(releaseIds) {
|
|
||||||
await knex.raw('REFRESH MATERIALIZED VIEW scenes_meta;');
|
|
||||||
|
|
||||||
await updateSqlSearch(releaseIds);
|
|
||||||
await updateManticoreSearch(releaseIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function updateMovieSearch(movieIds, target = 'movie') {
|
async function updateMovieSearch(movieIds, target = 'movie') {
|
||||||
logger.info(`Updating search documents for ${movieIds ? movieIds.length : 'all' } ${target}s`);
|
logger.info(`Updating search documents for ${movieIds ? movieIds.length : 'all' } ${target}s`);
|
||||||
|
|
||||||
|
|