Added trailers. Improved scene page scaling.

This commit is contained in:
2024-03-24 04:22:37 +01:00
parent 8a32febb8a
commit 08e4146d91
23 changed files with 3204 additions and 413 deletions

View File

@@ -71,7 +71,7 @@ export function sortActorsByGender(actors, context = {}) {
}
const alphaActors = actors.sort((actorA, actorB) => actorA.name.localeCompare(actorB.name, 'en'));
const genderActors = ['transsexual', 'female', 'male', undefined, null, 'male'].flatMap((gender) => alphaActors.filter((actor) => actor.gender === gender));
const genderActors = ['transsexual', 'female', undefined, null, 'male'].flatMap((gender) => alphaActors.filter((actor) => actor.gender === gender));
const titleSlug = slugify(context.title);
const titleActors = titleSlug ? genderActors.sort((actorA, actorB) => {
@@ -344,7 +344,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
actors.gender as gender,
actors.country as country,
actors.height as height,
actors.weight as weight,
actors.mass as mass,
actors.cup as cup,
actors.natural_boobs as natural_boobs,
actors.date_of_birth as date_of_birth,
@@ -352,16 +352,15 @@ async function queryManticoreSql(filters, options, _reqUser) {
actors.scenes as scenes,
actors.stashed as stashed,
created_at as stashed_at,
if(actors.date_of_birth, floor((now() - actors.date_of_birth) / 31556952), 0) as age
if(actors.date_of_birth, floor((now() - actors.date_of_birth) / 31556952), 0) as age,
weight() as _score
`));
// weight() as _score
builder
.innerJoin('actors', 'actors.id', 'actors_stashed.actor_id')
.where('stash_id', filters.stashId);
} else {
// builder.select(knex.raw('*, weight() as _score'));
builder.select(knex.raw('*'));
builder.select(knex.raw('*, weight() as _score'));
}
if (filters.query) {
@@ -374,7 +373,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
}
});
['age', 'height', 'weight'].forEach((attribute) => {
['age', 'height'].forEach((attribute) => {
if (filters[attribute]) {
builder
.where(attribute, '>=', filters[attribute][0])
@@ -382,6 +381,13 @@ async function queryManticoreSql(filters, options, _reqUser) {
}
});
if (filters.weight) {
// weight is a reserved keyword in manticore
builder
.where('mass', '>=', filters.weight[0])
.where('mass', '<=', filters.weight[1]);
}
if (filters.dateOfBirth && filters.dobType === 'dateOfBirth') {
builder.where('date_of_birth', Math.floor(filters.dateOfBirth.getTime() / 1000));
}
@@ -420,6 +426,11 @@ async function queryManticoreSql(filters, options, _reqUser) {
{ column: 'actors.scenes', order: options.order[1] },
{ column: 'actors.slug', order: 'asc' },
]);
} else if (options.order?.[0] === 'results') {
builder.orderBy([
{ column: 'actors._score', order: options.order[1] },
{ column: 'actors.slug', order: 'asc' },
]);
} else if (options.order?.[0] === 'stashed' && filters.stashId) {
builder.orderBy([
{ column: 'stashed_at', order: options.order[1] },