Compare commits
8 Commits
2f8fca0327
...
cefd91a7b9
Author | SHA1 | Date |
---|---|---|
|
cefd91a7b9 | |
|
ecdd6d8fb0 | |
|
60eb599416 | |
|
8e7b944b52 | |
|
6b17f9d1f2 | |
|
cb459d4cc7 | |
|
d795266114 | |
|
3e303e4b10 |
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.137.0",
|
"version": "1.137.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.137.0",
|
"version": "1.137.4",
|
||||||
"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": {
|
||||||
|
|
|
@ -6,6 +6,7 @@ const parentNetworks = [
|
||||||
slug: 'gamma',
|
slug: 'gamma',
|
||||||
name: 'Gamma Entertainment',
|
name: 'Gamma Entertainment',
|
||||||
url: 'https://www.gammaentertainment.com',
|
url: 'https://www.gammaentertainment.com',
|
||||||
|
alias: ['gammaentertainment'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
slug: 'hush',
|
slug: 'hush',
|
||||||
|
|
|
@ -146,7 +146,7 @@ const { argv } = yargs
|
||||||
describe: 'Limit amount of scenes when dates are missing.',
|
describe: 'Limit amount of scenes when dates are missing.',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: config.noDateLimit,
|
default: config.noDateLimit,
|
||||||
alias: ['no-date-limit', 'null-date-limit', 'limit'],
|
alias: ['null-date-limit', 'limit'],
|
||||||
})
|
})
|
||||||
.option('page', {
|
.option('page', {
|
||||||
describe: 'Page to start scraping at',
|
describe: 'Page to start scraping at',
|
||||||
|
|
|
@ -13,6 +13,11 @@ function curateEntity(entity, includeParameters = false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const logo = (entity.has_logo
|
||||||
|
&& (((entity.independent || entity.type === 'network') && `${entity.slug}/network.png`)
|
||||||
|
|| (entity.parent && `${entity.parent.slug}/${entity.slug}.png`)))
|
||||||
|
|| null;
|
||||||
|
|
||||||
const curatedEntity = entity.id ? {
|
const curatedEntity = entity.id ? {
|
||||||
id: entity.id,
|
id: entity.id,
|
||||||
name: entity.name,
|
name: entity.name,
|
||||||
|
@ -20,6 +25,9 @@ function curateEntity(entity, includeParameters = false) {
|
||||||
description: entity.description,
|
description: entity.description,
|
||||||
slug: entity.slug,
|
slug: entity.slug,
|
||||||
type: entity.type,
|
type: entity.type,
|
||||||
|
independent: !!entity.independent,
|
||||||
|
aliases: entity.alias,
|
||||||
|
logo,
|
||||||
parent: curateEntity(entity.parent, includeParameters),
|
parent: curateEntity(entity.parent, includeParameters),
|
||||||
} : {};
|
} : {};
|
||||||
|
|
||||||
|
@ -132,8 +140,9 @@ async function fetchEntity(entityId, type) {
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
queryBuilder
|
queryBuilder
|
||||||
|
.where('entities.type', type)
|
||||||
.where('entities.slug', entityId)
|
.where('entities.slug', entityId)
|
||||||
.where('entities.type', type);
|
.orWhere(knex.raw(':entityId = ANY(entities.alias)', { entityId }));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -172,9 +181,9 @@ async function fetchEntities(type, limit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchEntities(query, type, limit) {
|
async function searchEntities(query, type, limit) {
|
||||||
const entities = knex
|
const entities = await knex
|
||||||
.select(knex.raw(`
|
.select(knex.raw(`
|
||||||
entities.id, entities.name, entities.slug, entities.type, entities.url, entities.description,
|
entities.id, entities.name, entities.slug, entities.type, entities.url, entities.description, entities.alias, entities.has_logo,
|
||||||
COALESCE(json_agg(tags) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
|
COALESCE(json_agg(tags) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
|
||||||
row_to_json(parents) as parent
|
row_to_json(parents) as parent
|
||||||
`))
|
`))
|
||||||
|
@ -187,10 +196,10 @@ async function searchEntities(query, type, limit) {
|
||||||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||||
.leftJoin('entities_tags', 'entities_tags.entity_id', 'entities.id')
|
.leftJoin('entities_tags', 'entities_tags.entity_id', 'entities.id')
|
||||||
.leftJoin('tags', 'tags.id', 'entities_tags.tag_id')
|
.leftJoin('tags', 'tags.id', 'entities_tags.tag_id')
|
||||||
.groupBy('entities.id', 'entities.name', 'entities.slug', 'entities.type', 'entities.url', 'entities.description', 'parents.id')
|
.groupBy('entities.id', 'entities.name', 'entities.slug', 'entities.type', 'entities.url', 'entities.description', 'entities.alias', 'entities.has_logo', 'parents.id')
|
||||||
.limit(limit || 100);
|
.limit(limit || 100);
|
||||||
|
|
||||||
return curateEntities(await entities);
|
return curateEntities(entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function flushEntities(networkSlugs = [], channelSlugs = []) {
|
async function flushEntities(networkSlugs = [], channelSlugs = []) {
|
||||||
|
|
Loading…
Reference in New Issue