Compare commits

..

No commits in common. "6633ce78d04ac01320d82fddc1314dc977f13c9d" and "980efbc93d33613f361a782d647c7512748dfaf8" have entirely different histories.

8 changed files with 22 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View File

@ -507,8 +507,8 @@ const networks = [
exports.seed = knex => Promise.resolve()
.then(async () => {
const parentNetworkEntries = await upsert('entities', parentNetworks.map(network => ({ ...network, type: 'network' })), ['slug', 'type'], knex);
const parentNetworksBySlug = [].concat(parentNetworkEntries.inserted, parentNetworkEntries.updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const { inserted, updated } = await upsert('entities', parentNetworks.map(network => ({ ...network, type: 'network' })), ['slug', 'type'], knex);
const parentNetworksBySlug = [].concat(inserted, updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const networksWithParent = networks.map(network => ({
slug: network.slug,
@ -521,23 +521,5 @@ exports.seed = knex => Promise.resolve()
parent_id: parentNetworksBySlug[network.parent] || null,
}));
const networkEntries = await upsert('entities', networksWithParent, ['slug', 'type'], knex);
const networkIdsBySlug = [].concat(networkEntries.inserted, networkEntries.updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const tagSlugs = networks.map(network => network.tags).flat().filter(Boolean);
const tagEntries = await knex('tags').whereIn('slug', tagSlugs);
const tagIdsBySlug = tagEntries.reduce((acc, tag) => ({ ...acc, [tag.slug]: tag.id }), {});
const tagAssociations = networks
.map(network => (network.tags
? network.tags.map(tagSlug => ({
entity_id: networkIdsBySlug[network.slug],
tag_id: tagIdsBySlug[tagSlug],
inherit: true,
}))
: []))
.flat();
await upsert('entities_tags', tagAssociations, ['entity_id', 'tag_id'], knex);
return upsert('entities', networksWithParent, ['slug', 'type'], knex);
});

View File

@ -806,7 +806,6 @@ const tagPhotos = [
['fake-boobs', 15, 'Amber Jade and Karma Rx in "Amber In The Hills: Part 1" for Brazzers'],
// ['fake-boobs', 6, 'Cathy Heaven in "Heavenly Ass" for Big Wett Butts'],
['fake-boobs', 12, 'Nikki Monroe and Kortney Kane for Big Tits In Uniform'],
['fake-cum', 3, 'Alexia Anders in "Thanksgiving Creampies" for Cum 4K'],
['fake-cum', 0, 'Jynx Maze for Cumshot Surprise (Porn Pros)'],
['fake-cum', 1, 'Ricki White for Fucked Up Facials'],
['fingering', 2, 'Kylie Page and Hadley Viscara in "Busty Blonde Bombshells" for LesbianX'],

View File

@ -79,12 +79,13 @@ async function fetchIncludedEntities() {
};
const rawNetworks = await knex.raw(`
WITH RECURSIVE included_entities AS (
WITH RECURSIVE channels AS (
/* select configured channels and networks */
SELECT
entities.*
entities.*, json_agg(siblings) as siblings
FROM
entities
LEFT JOIN entities AS siblings ON siblings.parent_id = entities.parent_id
WHERE
CASE WHEN :includeAll
THEN
@ -101,16 +102,17 @@ async function fetchIncludedEntities() {
AND entities.type = 'network')
OR (entities.slug = ANY(:excludedChannels)
AND entities.type = 'channel'))
GROUP BY entities.id
UNION ALL
/* select recursive children of configured networks */
SELECT
entities.*
entities.*, null as siblings
FROM
entities
INNER JOIN
included_entities ON included_entities.id = entities.parent_id
channels ON channels.id = entities.parent_id
WHERE
NOT ((entities.slug = ANY(:excludedNetworks)
AND entities.type = 'network')
@ -119,20 +121,17 @@ async function fetchIncludedEntities() {
)
/* select recursive channels as children of networks */
SELECT
parents.*, json_agg(included_entities ORDER BY included_entities.id) as children
entities.*, json_agg(channels ORDER BY channels.id) as children
FROM
included_entities
channels
LEFT JOIN
entities AS parents ON parents.id = included_entities.parent_id
entities ON entities.id = channels.parent_id
WHERE
included_entities.type = 'channel'
channels.type = 'channel'
GROUP BY
parents.id;
entities.id;
`, include);
// console.log(rawNetworks.rows[0]);
// console.log(rawNetworks.toString());
const curatedNetworks = rawNetworks.rows.map(entity => curateEntity(entity, true));
return curatedNetworks;

View File

@ -6,21 +6,17 @@ const slugify = require('../utils/slugify');
function matchChannel(release, channel) {
const series = channel.children || channel.parent.children;
// console.log(series?.length, release.url, channel.name);
console.log(channel, series);
const serieNames = series.reduce((acc, serie) => ({
...acc,
[serie.name]: serie,
[serie.slug]: serie,
}), {
vr: 'littlecapricevr',
});
}), {});
const serieName = release.title.match(new RegExp(Object.keys(serieNames).join('|'), 'i'))?.[0];
const serie = serieName && serieNames[slugify(serieName, '')];
console.log(release.title, serieName);
if (serie) {
return {
channel: serie.slug,

View File

@ -207,12 +207,8 @@ async function fetchLatest(site, page = 1) {
const url = `${site.url}/api/videos?page=${page}`;
const res = await http.get(url);
if (res.ok) {
if (res.body.data.videos) {
return scrapeAll(res.body.data.videos, site);
}
return [];
if (res.status === 200) {
return scrapeAll(res.body.data.videos, site);
}
return res.status;
@ -222,12 +218,8 @@ async function fetchUpcoming(site) {
const apiUrl = `${site.url}/api`;
const res = await http.get(apiUrl);
if (res.ok) {
if (res.body.data.nextScene) {
return scrapeUpcoming(res.body.data.nextScene, site);
}
return [];
if (res.status === 200) {
return scrapeUpcoming(res.body.data.nextScene, site);
}
return res.status;
@ -239,7 +231,7 @@ async function fetchScene(url, site, baseRelease) {
const res = await http.get(apiUrl);
if (res.ok) {
if (res.status === 200) {
return scrapeScene(res.body.data, url, site, baseRelease);
}
@ -252,7 +244,7 @@ async function fetchProfile({ name: actorName }, { site }, include) {
const url = `${origin}/api/${actorSlug}`;
const res = await http.get(url);
if (res.ok) {
if (res.status === 200) {
return scrapeProfile(res.body.data, origin, include.scenes);
}