Added self hash filtering to media module. Moved Girl Girl back to Jules Jordan.

This commit is contained in:
ThePendulum 2020-04-02 01:10:50 +02:00
parent 9a712e7371
commit ad7874649f
8 changed files with 54 additions and 43 deletions

View File

@ -117,12 +117,12 @@ export default {
@import 'theme'; @import 'theme';
.banner { .banner {
background: $empty; background: var(--empty);
flex-shrink: 0; flex-shrink: 0;
white-space: nowrap; white-space: nowrap;
overflow-x: auto; overflow-x: auto;
scrollbar-width: none; scrollbar-width: none;
box-shadow: 0 0 3px $shadow; box-shadow: 0 0 3px var(--shadow);
font-size: 0; font-size: 0;
&::-webkit-scrollbar { &::-webkit-scrollbar {
@ -150,7 +150,7 @@ export default {
.icon { .icon {
width: 1.5rem; width: 1.5rem;
height: 1.5rem; height: 1.5rem;
fill: $highlight; fill: var(--lighten);
} }
&.playing { &.playing {
@ -162,7 +162,7 @@ export default {
opacity: 1; opacity: 1;
.icon { .icon {
fill: $highlight-strong; fill: var(--lighten-strong);
} }
} }
} }

View File

@ -42,13 +42,12 @@ export default {
background: var(--profile); background: var(--profile);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: left;
justify-content: flex-end; justify-content: flex-end;
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
box-shadow: inset 0 0 3px var(--darken); box-shadow: 0 0 3px var(--darken-weak);
} }
.poster { .poster {
@ -56,7 +55,6 @@ export default {
height: 16rem; height: 16rem;
object-fit: cover; object-fit: cover;
object-position: 50% 100%; object-position: 50% 100%;
box-shadow: 0 0 1px var(--darken);
} }
.title { .title {

View File

@ -296,6 +296,9 @@ exports.up = knex => Promise.resolve()
table.string('piercings'); table.string('piercings');
table.string('tattoos'); table.string('tattoos');
table.datetime('updated_at')
.defaultTo(knex.fn.now());
table.datetime('created_at') table.datetime('created_at')
.defaultTo(knex.fn.now()); .defaultTo(knex.fn.now());
})) }))

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -196,11 +196,6 @@ const networks = [
description: 'Girlsway.com has the best lesbian porn videos online! The hottest pornstars & first time lesbians in real girl on girl sex, tribbing, squirting & pussy licking action right HERE!', description: 'Girlsway.com has the best lesbian porn videos online! The hottest pornstars & first time lesbians in real girl on girl sex, tribbing, squirting & pussy licking action right HERE!',
parent: 'gamma', parent: 'gamma',
}, },
{
slug: 'girlgirl',
name: 'Girl Girl',
url: 'https://www.girlgirl.com',
},
{ {
slug: 'hussiepass', slug: 'hussiepass',
name: 'Hussie Pass', name: 'Hussie Pass',

View File

@ -2115,15 +2115,6 @@ const sites = [
tags: ['facefucking', 'blowjob'], tags: ['facefucking', 'blowjob'],
network: 'fullpornnetwork', network: 'fullpornnetwork',
}, },
// GIRL GIRL
{
slug: 'girlgirl',
name: 'Girl Girl',
url: 'https://www.girlgirl.com',
tags: ['lesbian'],
parameters: { independent: true },
network: 'girlgirl',
},
// GIRLSWAY // GIRLSWAY
{ {
slug: 'girlsway', slug: 'girlsway',
@ -2635,6 +2626,13 @@ const sites = [
url: 'https://www.manuelferrara.com', url: 'https://www.manuelferrara.com',
network: 'julesjordan', network: 'julesjordan',
}, },
{
slug: 'girlgirl',
name: 'Girl Girl',
url: 'https://www.girlgirl.com',
tags: ['lesbian'],
network: 'julesjordan',
},
// KELLY MADISON MEDIA // KELLY MADISON MEDIA
{ {
slug: 'teenfidelity', slug: 'teenfidelity',

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
const config = require('config'); const config = require('config');
const util = require('util'); // const util = require('util');
const Promise = require('bluebird'); const Promise = require('bluebird');
const fs = require('fs').promises; const fs = require('fs').promises;
const path = require('path'); const path = require('path');
@ -177,10 +177,7 @@ async function findSourceDuplicates(baseMedias) {
const existingSourceMediaByUrl = itemsByKey(existingSourceMedia, 'source'); const existingSourceMediaByUrl = itemsByKey(existingSourceMedia, 'source');
const existingExtractMediaByUrl = itemsByKey(existingExtractMedia, 'source_page'); const existingExtractMediaByUrl = itemsByKey(existingExtractMedia, 'source_page');
return { return [existingSourceMediaByUrl, existingExtractMediaByUrl];
existingSourceMediaByUrl,
existingExtractMediaByUrl,
};
} }
async function findHashDuplicates(medias) { async function findHashDuplicates(medias) {
@ -189,16 +186,37 @@ async function findHashDuplicates(medias) {
const existingHashMediaEntries = await knex('media').whereIn('hash', hashes); const existingHashMediaEntries = await knex('media').whereIn('hash', hashes);
const existingHashMediaEntriesByHash = itemsByKey(existingHashMediaEntries, 'hash'); const existingHashMediaEntriesByHash = itemsByKey(existingHashMediaEntries, 'hash');
const uniqueHashMedia = medias.filter(media => !media.entry && !existingHashMediaEntriesByHash[media.meta?.hash]); const uniqueHashMedias = medias.filter(media => !media.entry && !existingHashMediaEntriesByHash[media.meta?.hash]);
const existingHashMedia = medias const { selfDuplicateMedias, selfUniqueMediasByHash } = uniqueHashMedias.reduce((acc, media) => {
if (acc.selfUniqueMediasByHash[media.meta.hash]) {
acc.selfDuplicateMedias.push({
...media,
use: acc.selfUniqueMediasByHash[media.meta.hash].id,
});
return acc;
}
acc.selfUniqueMediasByHash[media.meta.hash] = media;
return acc;
}, {
selfDuplicateMedias: [],
selfUniqueMediasByHash: {},
});
const selfUniqueHashMedias = Object.values(selfUniqueMediasByHash);
const existingHashMedias = medias
.filter(media => existingHashMediaEntriesByHash[media.entry?.hash || media.meta?.hash]) .filter(media => existingHashMediaEntriesByHash[media.entry?.hash || media.meta?.hash])
.map(media => ({ .map(media => ({
...media, ...media,
entry: existingHashMediaEntriesByHash[media.entry?.hash || media.meta?.hash], entry: existingHashMediaEntriesByHash[media.entry?.hash || media.meta?.hash],
})); }))
.concat(selfDuplicateMedias);
return { uniqueHashMedia, existingHashMedia }; return [selfUniqueHashMedias, existingHashMedias];
} }
async function extractSource(baseSource, { existingExtractMediaByUrl }) { async function extractSource(baseSource, { existingExtractMediaByUrl }) {
@ -337,7 +355,7 @@ async function fetchSource(source) {
return attempt(1); return attempt(1);
} }
async function trySource(baseSource, existingMedias, baseMedia, baseSourceIndex) { async function trySource(baseSource, existingMedias) {
// catch error and try the next source // catch error and try the next source
const extractedSource = await extractSource(baseSource, existingMedias); const extractedSource = await extractSource(baseSource, existingMedias);
const existingSourceMedia = existingMedias.existingSourceMediaByUrl[extractedSource.src]; const existingSourceMedia = existingMedias.existingSourceMediaByUrl[extractedSource.src];
@ -350,7 +368,7 @@ async function trySource(baseSource, existingMedias, baseMedia, baseSourceIndex)
} }
if (existingSourceMedia) { if (existingSourceMedia) {
logger.silly(`Media source URL already in database, skipping ${baseSource.url}`); logger.silly(`Media source URL already in database, skipping ${baseSource.src}`);
// media entry found by source URL, don't fetch // media entry found by source URL, don't fetch
return { return {
@ -359,7 +377,7 @@ async function trySource(baseSource, existingMedias, baseMedia, baseSourceIndex)
}; };
} }
return fetchSource(extractedSource, baseMedia, baseSourceIndex, 1); return fetchSource(extractedSource);
} }
async function fetchMedia(baseMedia, existingMedias) { async function fetchMedia(baseMedia, existingMedias) {
@ -420,21 +438,21 @@ function curateMediaEntry(media, index) {
} }
async function storeMedias(baseMedias) { async function storeMedias(baseMedias) {
const { existingSourceMediaByUrl, existingExtractMediaByUrl } = await findSourceDuplicates(baseMedias); const [existingSourceMediaByUrl, existingExtractMediaByUrl] = await findSourceDuplicates(baseMedias);
const savedMedias = await Promise.map( const savedMedias = await Promise.map(
baseMedias, baseMedias,
async baseMedia => fetchMedia(baseMedia, { existingSourceMediaByUrl, existingExtractMediaByUrl }), async baseMedia => fetchMedia(baseMedia, { existingSourceMediaByUrl, existingExtractMediaByUrl }),
); );
const { uniqueHashMedia, existingHashMedia } = await findHashDuplicates(savedMedias); const [uniqueHashMedias, existingHashMedias] = await findHashDuplicates(savedMedias);
const newMediaWithEntries = uniqueHashMedia.map((media, index) => curateMediaEntry(media, index)); const newMediaWithEntries = uniqueHashMedias.map((media, index) => curateMediaEntry(media, index));
const newMediaEntries = newMediaWithEntries.filter(media => !media.newEntry).map(media => media.entry); const newMediaEntries = newMediaWithEntries.filter(media => media.newEntry).map(media => media.entry);
await knex('media').insert(newMediaEntries); await knex('media').insert(newMediaEntries);
return [...newMediaWithEntries, ...existingHashMedia]; return [...newMediaWithEntries, ...existingHashMedias];
} }
async function associateReleaseMedia(releases) { async function associateReleaseMedia(releases) {
@ -445,12 +463,13 @@ async function associateReleaseMedia(releases) {
// TODO: internal duplicate filtering // TODO: internal duplicate filtering
// TODO: media count limits // TODO: media count limits
// TODO: catch errors // TODO: catch errors
// TODO: stage by role
const baseMediasByReleaseId = releases.reduce((acc, release) => ({ const baseMediasByReleaseId = releases.reduce((acc, release) => ({
...acc, ...acc,
[release.id]: [ [release.id]: [
...(argv.images && argv.poster ? toBaseMedias([release.poster], 'posters') : []), ...(argv.images && argv.poster ? toBaseMedias([release.poster], 'posters') : []),
...(argv.images && argv.photos ? toBaseMedias(release.photos, 'photos').slice(0, 5) : []), ...(argv.images && argv.photos ? toBaseMedias(release.photos, 'photos') : []),
...(argv.videos && argv.trailer ? toBaseMedias([release.trailer], 'trailers') : []), ...(argv.videos && argv.trailer ? toBaseMedias([release.trailer], 'trailers') : []),
...(argv.videos && argv.teaser ? toBaseMedias([release.teaser], 'teasers') : []), ...(argv.videos && argv.teaser ? toBaseMedias([release.teaser], 'teasers') : []),
], ],
@ -473,17 +492,15 @@ async function associateReleaseMedia(releases) {
acc[media.role].push({ acc[media.role].push({
release_id: releaseId, release_id: releaseId,
media_id: media.entry.id, media_id: media.use || media.entry.id,
}); });
}); });
return acc; return acc;
}, {}); }, {});
console.log(util.inspect(associationsByRole, null, null));
await Promise.all(Object.entries(associationsByRole) await Promise.all(Object.entries(associationsByRole)
.map(async ([role, associations]) => knex(`releases_${role}`).insert(associations))); .map(async ([role, associations]) => knex.raw(`${knex(`releases_${role}`).insert(associations)} ON CONFLICT DO NOTHING`)));
} }
module.exports = { module.exports = {