Added unidentified actors and actor count filters.

This commit is contained in:
2026-11-11 22:23:50 +01:00
parent 10ac366e87
commit 76ccd3729f
24 changed files with 575 additions and 70 deletions
+6 -5
View File
@@ -1,6 +1,8 @@
import { Router } from 'express';
import omit from 'object.omit';
import { parseLetterRange, parseRange } from '../../utils/parse-range.js';
import {
createActor,
createActorRevision,
@@ -10,21 +12,20 @@ import {
mergeActors,
reviewActorRevision,
} from '../actors.js';
import { fetchStashByUsernameAndSlug } from '../stashes.js';
export function curateActorsQuery(query) {
return {
query: query.q,
gender: query.gender,
age: query.age?.split(',').map((age) => Number(age)),
age: parseRange(query.age),
dateOfBirth: query.dob && new Date(query.dob),
dobType: ({ dob: 'dateOfBirth', bd: 'birthday' })[query.dobt] || 'birthday',
cup: query.cup?.split(','),
cup: parseLetterRange(query.cup),
country: query.c,
naturalBoobs: query.nb,
height: query.height?.split(',').map((height) => Number(height)),
weight: query.weight?.split(',').map((weight) => Number(weight)),
height: parseRange(query.height),
weight: parseRange(query.weight),
requireAvatar: query.avatar,
stashId: Number(query.stashId) || null,
isGlobal: Object.hasOwn(query, 'global'),
+9 -1
View File
@@ -1,7 +1,8 @@
import { Router } from 'express';
import promiseProps from '../../utils/promise-props.js';
import { parseRange } from '../../utils/parse-range.js';
import promiseProps from '../../utils/promise-props.js';
import slugify from '../../utils/slugify.js';
import { getIdsBySlug } from '../cache.js';
@@ -41,6 +42,11 @@ export async function curateScenesQuery(query) {
years: splitYears.map((year) => Number(year)).filter(Boolean) || [],
actorIds: [query.actorId, ...splitActors.filter((actor) => actor.charAt(0) !== '!').map((identifier) => parseActorIdentifier(identifier)?.id)].filter(Boolean),
notActorIds: splitActors.filter((actor) => actor.charAt(0) === '!').map((identifier) => parseActorIdentifier(identifier.slice(1))?.id).filter(Boolean),
actorCount: parseRange(query.group),
femaleCount: parseRange(query.females),
maleCount: parseRange(query.males),
transCount: parseRange(query.trans),
unidentifiedCount: parseRange(query.unidentified), // for curators, e.g. unidentified=1- finds scenes with unidentified actors
tagIds,
notTagIds: notTagIds.filter((tagId) => !tagIds.includes(tagId)), // included tags get priority over excluded tags
onlyActorTags: !!query.at,
@@ -61,6 +67,7 @@ async function fetchScenesApi(req, res) {
aggTags,
aggActorTags,
aggChannels,
aggActorCounts,
limit,
total,
} = await fetchScenes(await curateScenesQuery({
@@ -80,6 +87,7 @@ async function fetchScenesApi(req, res) {
aggTags,
aggActorTags,
aggChannels,
aggActorCounts,
limit,
total,
});