forked from DebaucheryLibrarian/traxxx
Added Freaky Fembots to Team Skeet.
This commit is contained in:
parent
7e80cc628c
commit
a6fb572a21
|
@ -3,6 +3,7 @@ dist/
|
|||
log/
|
||||
media/
|
||||
html/
|
||||
data/
|
||||
tmp/*
|
||||
public/js/*
|
||||
public/css/*
|
||||
|
|
|
@ -12,6 +12,11 @@ module.exports = {
|
|||
password: 'password',
|
||||
database: 'traxxx',
|
||||
},
|
||||
manticore: {
|
||||
host: '127.0.0.1',
|
||||
sqlPort: 9306,
|
||||
httpPort: 9308,
|
||||
},
|
||||
timeout: 5000,
|
||||
graphiql: false,
|
||||
pool: {
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"escape-string-regexp": "^4.0.0",
|
||||
"express": "^4.18.2",
|
||||
"express-promise-router": "^4.1.1",
|
||||
"express-query-boolean": "^2.0.0",
|
||||
"express-react-views": "^0.11.0",
|
||||
"express-session": "^1.17.3",
|
||||
"face-api.js": "^0.22.2",
|
||||
|
@ -59,10 +60,12 @@
|
|||
"knex": "^3.0.1",
|
||||
"knex-migrate": "^1.7.4",
|
||||
"longjohn": "^0.2.12",
|
||||
"manticoresearch": "^4.0.0",
|
||||
"merge-anything": "^5.1.7",
|
||||
"mime": "^3.0.0",
|
||||
"mitt": "^3.0.1",
|
||||
"moment": "^2.29.4",
|
||||
"mysql": "^2.18.1",
|
||||
"nanoid": "^3.3.7",
|
||||
"node-fetch": "^3.3.2",
|
||||
"object-merge-advanced": "^12.1.0",
|
||||
|
@ -6690,6 +6693,14 @@
|
|||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/bignumber.js": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/binary-extensions": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||
|
@ -7550,6 +7561,14 @@
|
|||
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
|
||||
"integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg=="
|
||||
},
|
||||
"node_modules/component-emitter": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz",
|
||||
"integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
|
@ -7653,6 +7672,11 @@
|
|||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
|
||||
},
|
||||
"node_modules/cookiejar": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz",
|
||||
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw=="
|
||||
},
|
||||
"node_modules/core-js": {
|
||||
"version": "2.6.12",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz",
|
||||
|
@ -9335,6 +9359,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/express-query-boolean": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/express-query-boolean/-/express-query-boolean-2.0.0.tgz",
|
||||
"integrity": "sha512-4dU/1HPm8lkTPR12+HFUXqCarcsC19OKOkb4otLOuADfPYrQMaugPJkSmxNsqwmWYjozvT6vdTiqkgeBHkzOow=="
|
||||
},
|
||||
"node_modules/express-react-views": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/express-react-views/-/express-react-views-0.11.0.tgz",
|
||||
|
@ -9562,6 +9591,11 @@
|
|||
"resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
|
||||
"integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
|
||||
},
|
||||
"node_modules/fast-safe-stringify": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
||||
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="
|
||||
},
|
||||
"node_modules/fast-xml-parser": {
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.5.tgz",
|
||||
|
@ -10001,6 +10035,15 @@
|
|||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/formidable": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz",
|
||||
"integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==",
|
||||
"deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau",
|
||||
"funding": {
|
||||
"url": "https://ko-fi.com/tunnckoCore/commissions"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
|
@ -12767,6 +12810,14 @@
|
|||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/manticoresearch": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/manticoresearch/-/manticoresearch-4.0.0.tgz",
|
||||
"integrity": "sha512-BiSbEsQFfbbLsAgF08s6BRNPMVR4tJGg479HUjIQQ6Vxscc3KFiL74mLGfn9VEjE8ZboUNZyNm2H6OqIVosBiA==",
|
||||
"dependencies": {
|
||||
"superagent": "5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/map-obj": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
|
||||
|
@ -13308,6 +13359,39 @@
|
|||
"npm": ">=5"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql": {
|
||||
"version": "2.18.1",
|
||||
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
|
||||
"integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
|
||||
"dependencies": {
|
||||
"bignumber.js": "9.0.0",
|
||||
"readable-stream": "2.3.7",
|
||||
"safe-buffer": "5.1.2",
|
||||
"sqlstring": "2.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql/node_modules/readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"dependencies": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"node_modules/nan": {
|
||||
"version": "2.18.0",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
|
||||
|
@ -16966,6 +17050,14 @@
|
|||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/sqlstring": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||
"integrity": "sha512-ooAzh/7dxIG5+uDik1z/Rd1vli0+38izZhGzSa34FwR7IbelPWCCKSNIl8jlL/F7ERvy8CB2jNeM1E9i9mXMAQ==",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/sshpk": {
|
||||
"version": "1.18.0",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz",
|
||||
|
@ -17337,6 +17429,65 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/superagent": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/superagent/-/superagent-5.1.0.tgz",
|
||||
"integrity": "sha512-7V6JVx5N+eTL1MMqRBX0v0bG04UjrjAvvZJTF/VDH/SH2GjSLqlrcYepFlpTrXpm37aSY6h3GGVWGxXl/98TKA==",
|
||||
"deprecated": "Please upgrade to v7.0.2+ of superagent. We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing. See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.",
|
||||
"dependencies": {
|
||||
"component-emitter": "^1.3.0",
|
||||
"cookiejar": "^2.1.2",
|
||||
"debug": "^4.1.1",
|
||||
"fast-safe-stringify": "^2.0.6",
|
||||
"form-data": "^2.3.3",
|
||||
"formidable": "^1.2.1",
|
||||
"methods": "^1.1.2",
|
||||
"mime": "^2.4.4",
|
||||
"qs": "^6.7.0",
|
||||
"readable-stream": "^3.4.0",
|
||||
"semver": "^6.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/superagent/node_modules/form-data": {
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
|
||||
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12"
|
||||
}
|
||||
},
|
||||
"node_modules/superagent/node_modules/mime": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
|
||||
"integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/superagent/node_modules/readable-stream": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/supports-color": {
|
||||
"version": "5.5.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
"escape-string-regexp": "^4.0.0",
|
||||
"express": "^4.18.2",
|
||||
"express-promise-router": "^4.1.1",
|
||||
"express-query-boolean": "^2.0.0",
|
||||
"express-react-views": "^0.11.0",
|
||||
"express-session": "^1.17.3",
|
||||
"face-api.js": "^0.22.2",
|
||||
|
@ -118,10 +119,12 @@
|
|||
"knex": "^3.0.1",
|
||||
"knex-migrate": "^1.7.4",
|
||||
"longjohn": "^0.2.12",
|
||||
"manticoresearch": "^4.0.0",
|
||||
"merge-anything": "^5.1.7",
|
||||
"mime": "^3.0.0",
|
||||
"mitt": "^3.0.1",
|
||||
"moment": "^2.29.4",
|
||||
"mysql": "^2.18.1",
|
||||
"nanoid": "^3.3.7",
|
||||
"node-fetch": "^3.3.2",
|
||||
"object-merge-advanced": "^12.1.0",
|
||||
|
|
|
@ -10814,6 +10814,13 @@ const sites = [
|
|||
parameters: { id: 'pervdriver' },
|
||||
parent: 'teamskeet',
|
||||
},
|
||||
{
|
||||
slug: 'freakyfembots',
|
||||
name: 'Freaky Fembots',
|
||||
url: 'https://www.teamskeet.com/series/freakyfembots',
|
||||
parameters: { id: 'freakyfembots' },
|
||||
parent: 'teamskeet',
|
||||
},
|
||||
{
|
||||
slug: 'teamskeetclassics',
|
||||
name: 'Team Skeet Classics',
|
||||
|
|
|
@ -1783,5 +1783,5 @@ const countries = [
|
|||
},
|
||||
];
|
||||
|
||||
exports.seed = knex => knex('countries')
|
||||
exports.seed = (knex) => knex('countries')
|
||||
.then(async () => upsert('countries', countries, 'alpha2', knex));
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
"no-tabs": "off",
|
||||
"no-unused-vars": ["error", {"argsIgnorePattern": "^_"}],
|
||||
"no-console": 0,
|
||||
"max-len": 0,
|
||||
"no-underscore-dangle": 0,
|
||||
"default-param-last": 0,
|
||||
"prefer-destructuring": "off",
|
||||
"template-curly-spacing": "off",
|
||||
"object-curly-newline": "off",
|
||||
"max-len": [2, {"code": 300, "tabWidth": 4, "ignoreUrls": true}]
|
||||
"object-curly-newline": "off"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
|
||||
const config = require('config');
|
||||
const manticore = require('manticoresearch');
|
||||
const args = require('yargs').argv;
|
||||
|
||||
const knex = require('../knex');
|
||||
|
||||
const mantiClient = new manticore.ApiClient();
|
||||
|
||||
mantiClient.basePath = `http://${config.database.manticore.host}:${config.database.manticore.httpPort}`;
|
||||
|
||||
const searchApi = new manticore.SearchApi(mantiClient);
|
||||
|
||||
const utilsApi = new manticore.UtilsApi(mantiClient);
|
||||
const indexApi = new manticore.IndexApi(mantiClient);
|
||||
|
||||
const update = args.update;
|
||||
|
||||
async function fetchActors() {
|
||||
// manually select date of birth, otherwise it is retrieved in local timezone but interpreted as UTC...
|
||||
const actors = await knex.raw(`
|
||||
SELECT actors.*, date_of_birth AT TIME ZONE 'Europe/Amsterdam' AT TIME ZONE 'UTC' as dob
|
||||
FROM actors
|
||||
GROUP BY actors.id;
|
||||
`);
|
||||
|
||||
return actors.rows;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
if (update) {
|
||||
await utilsApi.sql('drop table actors');
|
||||
await utilsApi.sql(`create table actors(
|
||||
id int,
|
||||
name text,
|
||||
slug string,
|
||||
gender string,
|
||||
date_of_birth timestamp,
|
||||
country string,
|
||||
has_avatar bool,
|
||||
weight int,
|
||||
height int,
|
||||
cup string,
|
||||
natural_boobs int,
|
||||
penis_length int,
|
||||
penis_girth int
|
||||
)`);
|
||||
|
||||
const actors = await fetchActors();
|
||||
|
||||
const docs = actors.map((actor) => ({
|
||||
insert: {
|
||||
index: 'actors',
|
||||
id: actor.id,
|
||||
doc: {
|
||||
name: actor.name,
|
||||
slug: actor.slug,
|
||||
gender: actor.gender || undefined,
|
||||
date_of_birth: actor.dob ? Math.round(actor.dob.getTime() / 1000) : undefined,
|
||||
has_avatar: !!actor.avatar_media_id,
|
||||
country: actor.birth_country_alpha2 || undefined,
|
||||
height: actor.height || undefined,
|
||||
weight: actor.weight || undefined,
|
||||
cup: actor.cup || undefined,
|
||||
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_girth: actor.penis_girth || undefined,
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
const data = await indexApi.bulk(docs.map((doc) => JSON.stringify(doc)).join('\n')).catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
console.log('data', data);
|
||||
knex.destroy();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await searchApi.search({
|
||||
index: 'actors',
|
||||
query: {
|
||||
equals: {
|
||||
has_avatar: 1,
|
||||
},
|
||||
},
|
||||
limit: 3,
|
||||
sort: [{ slug: 'asc' }],
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
console.log(result.hits?.hits);
|
||||
|
||||
knex.destroy();
|
||||
}
|
||||
|
||||
init();
|
|
@ -0,0 +1,238 @@
|
|||
'use strict';
|
||||
|
||||
const config = require('config');
|
||||
const manticore = require('manticoresearch');
|
||||
const args = require('yargs').argv;
|
||||
|
||||
const knex = require('../knex');
|
||||
|
||||
const mantiClient = new manticore.ApiClient();
|
||||
|
||||
mantiClient.basePath = `http://${config.database.manticore.host}:${config.database.manticore.httpPort}`;
|
||||
|
||||
const searchApi = new manticore.SearchApi(mantiClient);
|
||||
|
||||
const utilsApi = new manticore.UtilsApi(mantiClient);
|
||||
const indexApi = new manticore.IndexApi(mantiClient);
|
||||
|
||||
const update = args.update;
|
||||
|
||||
async function fetchScenes() {
|
||||
const scenes = await knex.raw(`
|
||||
SELECT
|
||||
releases.id AS id,
|
||||
releases.title,
|
||||
releases.created_at,
|
||||
releases.date,
|
||||
releases.entry_id,
|
||||
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 releases
|
||||
LEFT JOIN entities ON releases.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 = releases.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 = releases.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
|
||||
GROUP BY releases.id, entities.id, entities.name, entities.slug, entities.alias, parents.id, parents.name, parents.slug, parents.alias;
|
||||
`);
|
||||
|
||||
return scenes.rows;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
if (update) {
|
||||
await utilsApi.sql('drop table scenes');
|
||||
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,
|
||||
date timestamp,
|
||||
created_at timestamp,
|
||||
effective_date timestamp
|
||||
)`);
|
||||
|
||||
const scenes = await fetchScenes();
|
||||
|
||||
const docs = scenes.map((scene) => ({
|
||||
insert: {
|
||||
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(),
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
const data = await indexApi.bulk(docs.map((doc) => JSON.stringify(doc)).join('\n'));
|
||||
|
||||
console.log('data', data);
|
||||
}
|
||||
|
||||
/*
|
||||
const searchRequest = new manticore.SearchRequest();
|
||||
|
||||
searchRequest.index = 'scenes';
|
||||
searchRequest.attr_filter = new manticore.InFilter('ratings', [600]);
|
||||
|
||||
const result = await searchApi.search(searchRequest);
|
||||
*/
|
||||
|
||||
const result = await searchApi.search({
|
||||
index: 'scenes',
|
||||
query: {
|
||||
bool: {
|
||||
must: [
|
||||
/*
|
||||
{
|
||||
match: {
|
||||
'*': 'going-all-out-with-a-gangbang_1080p.mp4',
|
||||
},
|
||||
},
|
||||
*/
|
||||
{
|
||||
range: {
|
||||
effective_date: {
|
||||
lte: Math.round(Date.now() / 1000),
|
||||
},
|
||||
},
|
||||
},
|
||||
/*
|
||||
{
|
||||
equals: {
|
||||
actor_ids: 81930,
|
||||
},
|
||||
},
|
||||
*/
|
||||
],
|
||||
must_not: [
|
||||
{
|
||||
in: {
|
||||
tag_ids: [101, 180, 32],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
limit: 30,
|
||||
sort: [{ effective_date: 'desc' }],
|
||||
/*
|
||||
aggs: {
|
||||
tags: {
|
||||
terms: {
|
||||
field: 'tag_ids',
|
||||
size: 100,
|
||||
},
|
||||
},
|
||||
actors: {
|
||||
terms: {
|
||||
field: 'actor_ids',
|
||||
size: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
*/
|
||||
});
|
||||
|
||||
console.log(result);
|
||||
|
||||
/*
|
||||
if (result.hits) {
|
||||
result.hits.hits.map((hit) => console.log(hit));
|
||||
|
||||
// console.log(result.aggregations.actors);
|
||||
// console.log(result.aggregations.tags);
|
||||
|
||||
const sceneIds = result.hits.hits.map((hit) => hit._id);
|
||||
|
||||
console.time('fetch');
|
||||
|
||||
const [scenes, actors, tags, posters, photos] = await Promise.all([
|
||||
knex('releases').whereIn('id', sceneIds),
|
||||
knex('releases_actors')
|
||||
.whereIn('release_id', sceneIds)
|
||||
.leftJoin('actors', 'actors.id', 'releases_actors.actor_id'),
|
||||
knex('releases_tags')
|
||||
.whereIn('release_id', sceneIds)
|
||||
.leftJoin('tags', 'tags.id', 'releases_tags.tag_id'),
|
||||
knex('releases_posters')
|
||||
.whereIn('release_id', sceneIds)
|
||||
.leftJoin('media', 'media.id', 'releases_posters.media_id'),
|
||||
knex('releases_photos')
|
||||
.whereIn('release_id', sceneIds)
|
||||
.leftJoin('media', 'media.id', 'releases_photos.media_id'),
|
||||
]);
|
||||
|
||||
console.timeEnd('fetch');
|
||||
|
||||
console.time('join');
|
||||
|
||||
const joinedScenes = await knex('releases')
|
||||
.select(knex.raw(`
|
||||
releases.*,
|
||||
COALESCE(json_agg(DISTINCT actors) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors,
|
||||
COALESCE(json_agg(DISTINCT tags) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
|
||||
COALESCE(json_agg(DISTINCT posters) FILTER (WHERE posters.id IS NOT NULL), '[]') as posters,
|
||||
COALESCE(json_agg(DISTINCT photos) FILTER (WHERE photos.id IS NOT NULL), '[]') as photos
|
||||
`))
|
||||
.whereIn('releases.id', sceneIds)
|
||||
.leftJoin('releases_actors', 'releases_actors.release_id', 'releases.id')
|
||||
.leftJoin('actors', 'actors.id', 'releases_actors.actor_id')
|
||||
.leftJoin('releases_tags', 'releases_tags.release_id', 'releases.id')
|
||||
.leftJoin('tags', 'tags.id', 'releases_tags.tag_id')
|
||||
.leftJoin('releases_posters', 'releases_posters.release_id', 'releases.id')
|
||||
.leftJoin('media as posters', 'posters.id', 'releases_posters.media_id')
|
||||
.leftJoin('releases_photos', 'releases_photos.release_id', 'releases.id')
|
||||
.leftJoin('media as photos', 'photos.id', 'releases_photos.media_id')
|
||||
.groupBy('releases.id');
|
||||
|
||||
// console.log(joinedScenes[0]);
|
||||
|
||||
console.timeEnd('join');
|
||||
|
||||
console.log(sceneIds);
|
||||
console.log(scenes);
|
||||
console.log(actors);
|
||||
console.log(tags);
|
||||
console.log(posters);
|
||||
console.log(photos);
|
||||
}
|
||||
*/
|
||||
|
||||
knex.destroy();
|
||||
}
|
||||
|
||||
init();
|
|
@ -6,9 +6,11 @@ const autoprefixer = require('autoprefixer');
|
|||
const ESLintPlugin = require('eslint-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: './assets/js/main.js',
|
||||
entry: {
|
||||
bundle: './assets/js/main.js',
|
||||
},
|
||||
output: {
|
||||
filename: 'bundle.js',
|
||||
filename: '[name].js',
|
||||
path: path.join(__dirname, 'public/js'),
|
||||
},
|
||||
module: {
|
||||
|
|
Loading…
Reference in New Issue