Fixed seed files for stand-alone channel entities.

This commit is contained in:
ThePendulum 2020-06-28 00:44:53 +02:00
parent 3462d7af2a
commit 7d31dd8d52
6 changed files with 243 additions and 207 deletions

View File

@ -4,32 +4,46 @@
class="entity content" class="entity content"
> >
<div class="info"> <div class="info">
<img <template v-if="entity.hasLogo">
v-if="$route.name === 'network'" <img
class="logo" v-if="$route.name === 'network'"
:src="`/img/logos/${entity.slug}/thumbs/network.png`" class="logo"
> :src="`/img/logos/${entity.slug}/thumbs/network.png`"
>
<img <img
v-else-if="entity.parent" v-else-if="entity.parent"
class="logo" class="logo"
:src="`/img/logos/${entity.parent.slug}/thumbs/${entity.slug}.png`" :src="`/img/logos/${entity.parent.slug}/thumbs/${entity.slug}.png`"
> >
<img <img
v-else
class="logo"
:src="`/img/logos/${entity.slug}/thumbs/${entity.slug}.png`"
>
</template>
<h2
v-else v-else
class="logo" class="name"
:src="`/img/logos/${entity.slug}/thumbs/${entity.slug}.png`" >{{ entity.name }}</h2>
>
<router-link <router-link
v-if="entity.parent" v-if="entity.parent"
:to="`/${entity.parent.type}/${entity.parent.slug}`" :to="`/${entity.parent.type}/${entity.parent.slug}`"
class="link parent-link"
> >
<img <img
v-if="entity.parent.hasLogo"
class="logo logo-parent" class="logo logo-parent"
:src="`/img/logos/${entity.parent.slug}/thumbs/network.png`" :src="`/img/logos/${entity.parent.slug}/thumbs/network.png`"
> >
<h3
v-else
class="name parent-name"
>{{ entity.parent.name }}</h3>
</router-link> </router-link>
</div> </div>
@ -136,6 +150,12 @@ export default {
padding: 1rem; padding: 1rem;
background: var(--profile); background: var(--profile);
border-bottom: solid 1px var(--lighten-hint); border-bottom: solid 1px var(--lighten-hint);
.link {
display: flex;
align-items: center;
text-decoration: none;
}
} }
.logo { .logo {
@ -146,6 +166,15 @@ export default {
object-position: 0 50%; object-position: 0 50%;
} }
.name {
color: var(--text-light);
display: flex;
align-items: center;
padding: 0;
margin: 0;
font-size: 1.5rem;
}
.logo-parent { .logo-parent {
object-position: 100% 50%; object-position: 100% 50%;
} }

View File

@ -4,26 +4,33 @@
:title="entity.name" :title="entity.name"
class="tile" class="tile"
> >
<img <template v-if="entity.hasLogo">
v-if="entity.type === 'network'" <img
:src="`/img/logos/${entity.slug}/thumbs/network.png`" v-if="entity.type === 'network'"
:alt="entity.name" :src="`/img/logos/${entity.slug}/thumbs/network.png`"
class="logo" :alt="entity.name"
> class="logo"
>
<img <img
v-else-if="entity.parent" v-else-if="entity.parent"
:src="`/img/logos/${entity.parent.slug}/thumbs/${entity.slug}.png`" :src="`/img/logos/${entity.parent.slug}/thumbs/${entity.slug}.png`"
:alt="entity.name" :alt="entity.name"
class="logo" class="logo"
> >
<img <img
v-else
:src="`/img/logos/${entity.slug}/thumbs/${entity.slug}.png`"
:alt="entity.name"
class="logo"
>
</template>
<span
v-else v-else
:src="`/img/logos/${entity.slug}/thumbs/${entity.slug}.png`" class="name"
:alt="entity.name" >{{ entity.name }}</span>
class="logo"
>
</router-link> </router-link>
</template> </template>
@ -53,29 +60,20 @@ export default {
border-radius: .25rem; border-radius: .25rem;
box-shadow: 0 0 3px rgba(0, 0, 0, .25); box-shadow: 0 0 3px rgba(0, 0, 0, .25);
text-align: center; text-align: center;
}
.link {
text-decoration: none; text-decoration: none;
} }
.logo { .logo {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
color: $text-contrast;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 1rem;
font-weight: bold;
filter: $logo-highlight;
} }
.title { .name {
color: $text; color: var(--text-light);
height: 100%; font-size: 1.25rem;
display: flex; font-weight: bold;
align-items: center;
margin: 0;
} }
</style> </style>

View File

@ -32,6 +32,7 @@ function initEntitiesActions(store, _router) {
name name
slug slug
url url
hasLogo
children: childEntities( children: childEntities(
orderBy: [PRIORITY_DESC, NAME_ASC], orderBy: [PRIORITY_DESC, NAME_ASC],
) { ) {
@ -41,6 +42,7 @@ function initEntitiesActions(store, _router) {
url url
type type
priority priority
hasLogo
} }
parent { parent {
id id
@ -48,6 +50,7 @@ function initEntitiesActions(store, _router) {
slug slug
type type
url url
hasLogo
} }
} }
connection: releasesConnection( connection: releasesConnection(
@ -143,6 +146,7 @@ function initEntitiesActions(store, _router) {
slug slug
type type
url url
hasLogo
} }
} }
`, { `, {
@ -167,11 +171,13 @@ function initEntitiesActions(store, _router) {
slug slug
type type
url url
hasLogo
parent { parent {
name name
slug slug
type type
url url
hasLogo
} }
} }
} }

View File

@ -174,10 +174,12 @@ exports.up = knex => Promise.resolve()
table.text('description'); table.text('description');
table.json('parameters'); table.json('parameters');
table.boolean('active');
table.integer('priority', 3) table.integer('priority', 3)
.defaultTo(0); .defaultTo(0);
table.boolean('has_logo')
.defaultTo(true);
table.datetime('created_at') table.datetime('created_at')
.defaultTo(knex.fn.now()); .defaultTo(knex.fn.now());
})) }))

View File

@ -1157,7 +1157,6 @@ const sites = [
url: 'https://www.sunlustxxx.com', url: 'https://www.sunlustxxx.com',
description: '', description: '',
parent: 'blowpass', parent: 'blowpass',
active: true, // site offline, use only for indexing old scenes
}, },
// BOOBPEDIA // BOOBPEDIA
{ {
@ -1555,6 +1554,7 @@ const sites = [
url: 'https://www.digitalplayground.com/scenes?site=206', url: 'https://www.digitalplayground.com/scenes?site=206',
description: '', description: '',
parent: 'digitalplayground', parent: 'digitalplayground',
hasLogo: false,
}, },
{ {
slug: 'flixxx', slug: 'flixxx',
@ -1583,6 +1583,7 @@ const sites = [
url: 'https://www.digitalplayground.com/scenes?site=211', url: 'https://www.digitalplayground.com/scenes?site=211',
description: '', description: '',
parent: 'digitalplayground', parent: 'digitalplayground',
hasLogo: false,
}, },
{ {
slug: 'dpparodies', slug: 'dpparodies',
@ -1875,7 +1876,6 @@ const sites = [
description: 'Welcome the official Daring Sex site, home of high quality erotica, sensual porn and hardcore exploration of the darker side of sexuality. Here you will find a variety of videos for lovers looking for a bit of extra, or something darker with an element of control.', description: 'Welcome the official Daring Sex site, home of high quality erotica, sensual porn and hardcore exploration of the darker side of sexuality. Here you will find a variety of videos for lovers looking for a bit of extra, or something darker with an element of control.',
parent: 'famedigital', parent: 'famedigital',
parameters: { api: true }, parameters: { api: true },
active: false, // no data sources
}, },
{ {
slug: 'peternorth', slug: 'peternorth',
@ -4928,7 +4928,6 @@ const sites = [
slug: 'bigboobbundle', slug: 'bigboobbundle',
url: 'https://www.bigboobbundle.com', url: 'https://www.bigboobbundle.com',
parent: 'score', parent: 'score',
active: false, // all content appears to be on subsites
}, },
{ {
name: 'Big Boobs POV', name: 'Big Boobs POV',
@ -5220,7 +5219,6 @@ const sites = [
slug: 'milfbundle', slug: 'milfbundle',
url: 'https://www.milfbundle.com', url: 'https://www.milfbundle.com',
parent: 'score', parent: 'score',
active: false,
}, },
{ {
name: 'Teaming Cock', name: 'Teaming Cock',
@ -5287,7 +5285,6 @@ const sites = [
slug: 'pornmegaload', slug: 'pornmegaload',
url: 'https://www.pornmegaload.com', url: 'https://www.pornmegaload.com',
parent: 'score', parent: 'score',
active: false,
}, },
{ {
name: 'SaRennas World', name: 'SaRennas World',
@ -5325,7 +5322,6 @@ const sites = [
url: 'https://www.scorepass.com/scorelandtv', url: 'https://www.scorepass.com/scorelandtv',
parent: 'score', parent: 'score',
priority: 1, priority: 1,
active: false, // appears to be streaming service for other sites
}, },
{ {
name: 'ScoreTV', name: 'ScoreTV',
@ -5333,7 +5329,6 @@ const sites = [
url: 'https://www.scoretv.tv', url: 'https://www.scoretv.tv',
parent: 'score', parent: 'score',
priority: 1, priority: 1,
active: false, // similar to or same as Scoreland TV
}, },
{ {
name: 'Score Videos', name: 'Score Videos',
@ -6366,7 +6361,10 @@ const sites = [
/* eslint-disable max-len */ /* eslint-disable max-len */
exports.seed = knex => Promise.resolve() exports.seed = knex => Promise.resolve()
.then(async () => { .then(async () => {
const networks = await knex('entities').where('type', 'network'); const networks = await knex('entities')
.where('type', 'network')
.orWhereNull('parent_id');
const networksMap = networks.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {}); const networksMap = networks.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const tags = await knex('tags').select('*').where('alias_for', null); const tags = await knex('tags').select('*').where('alias_for', null);
@ -6382,7 +6380,7 @@ exports.seed = knex => Promise.resolve()
parameters: site.parameters, parameters: site.parameters,
parent_id: networksMap[site.parent], parent_id: networksMap[site.parent],
priority: site.priority, priority: site.priority,
active: site.show, has_logo: site.hasLogo,
})); }));
const { inserted, updated } = await upsert('entities', sitesWithNetworks, ['slug', 'type'], knex); const { inserted, updated } = await upsert('entities', sitesWithNetworks, ['slug', 'type'], knex);

View File

@ -1,166 +1,169 @@
const upsert = require('../src/utils/upsert'); const upsert = require('../src/utils/upsert');
function getStudios(networksMap) { const studios = [
return [ // LegalPorno
// LegalPorno {
{ slug: 'gonzocom',
slug: 'gonzocom', name: 'Gonzo.com',
name: 'Gonzo.com', url: 'https://www.legalporno.com/studios/gonzo_com',
url: 'https://www.legalporno.com/studios/gonzo_com', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'giorgiograndi',
slug: 'giorgiograndi', name: 'Giorgio Grandi',
name: 'Giorgio Grandi', url: 'https://www.legalporno.com/studios/giorgio-grandi',
url: 'https://www.legalporno.com/studios/giorgio-grandi', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'hardpornworld',
slug: 'hardpornworld', name: 'Hard Porn World',
name: 'Hard Porn World', url: 'https://www.legalporno.com/studios/hard-porn-world',
url: 'https://www.legalporno.com/studios/hard-porn-world', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'interracialvision',
slug: 'interracialvision', name: 'Interracial Vision',
name: 'Interracial Vision', url: 'https://www.legalporno.com/studios/interracial-vision',
url: 'https://www.legalporno.com/studios/interracial-vision', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'giorgioslab',
slug: 'giorgioslab', name: 'Giorgio\'s Lab',
name: 'Giorgio\'s Lab', url: 'https://www.legalporno.com/studios/giorgio--s-lab',
url: 'https://www.legalporno.com/studios/giorgio--s-lab', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'americananal',
slug: 'americananal', name: 'American Anal',
name: 'American Anal', url: 'https://www.legalporno.com/studios/american-anal',
url: 'https://www.legalporno.com/studios/american-anal', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'assablanca',
slug: 'assablanca', name: 'Assablanca',
name: 'Assablanca', url: 'https://www.legalporno.com/studios/assablanca',
url: 'https://www.legalporno.com/studios/assablanca', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'focus',
slug: 'focus', name: 'Focus',
name: 'Focus', url: 'https://www.legalporno.com/studios/focus',
url: 'https://www.legalporno.com/studios/focus', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'analforever',
slug: 'analforever', name: 'Anal Forever',
name: 'Anal Forever', url: 'https://www.legalporno.com/studios/anal-forever',
url: 'https://www.legalporno.com/studios/anal-forever', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'gonzoinbrazil',
slug: 'gonzoinbrazil', name: 'Gonzo in Brazil',
name: 'Gonzo in Brazil', url: 'https://www.legalporno.com/studios/gonzo-in-brazil',
url: 'https://www.legalporno.com/studios/gonzo-in-brazil', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'mranal',
slug: 'mranal', name: 'Mr Anal',
name: 'Mr Anal', url: 'https://www.legalporno.com/studios/mr-anal',
url: 'https://www.legalporno.com/studios/mr-anal', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'tarrawhite',
slug: 'tarrawhite', name: 'Tarra White',
name: 'Tarra White', url: 'https://www.legalporno.com/studios/tarra-white',
url: 'https://www.legalporno.com/studios/tarra-white', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'sineplexsos',
slug: 'sineplexsos', name: 'Sineplex SOS',
name: 'Sineplex SOS', url: 'https://www.legalporno.com/studios/sineplex-sos',
url: 'https://www.legalporno.com/studios/sineplex-sos', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'fmodels',
slug: 'fmodels', name: 'F Models',
name: 'F Models', url: 'https://www.legalporno.com/studios/f-models',
url: 'https://www.legalporno.com/studios/f-models', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'sineplexcz',
slug: 'sineplexcz', name: 'Sineplex CZ',
name: 'Sineplex CZ', url: 'https://www.legalporno.com/studios/sineplex-cz',
url: 'https://www.legalporno.com/studios/sineplex-cz', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'gg',
slug: 'gg', name: 'GG',
name: 'GG', url: 'https://www.legalporno.com/studios/gg',
url: 'https://www.legalporno.com/studios/gg', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'firstgape',
slug: 'firstgape', name: 'First Gape',
name: 'First Gape', url: 'https://www.legalporno.com/studios/first-gape',
url: 'https://www.legalporno.com/studios/first-gape', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'omargalantiproductions',
slug: 'omargalantiproductions', name: 'Omar Galanti Productions',
name: 'Omar Galanti Productions', url: 'https://www.legalporno.com/studios/omar-galanti-productions',
url: 'https://www.legalporno.com/studios/omar-galanti-productions', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'norestfortheass',
slug: 'norestfortheass', name: 'No Rest For The Ass',
name: 'No Rest For The Ass', url: 'https://www.legalporno.com/studios/no-rest-for-the-ass',
url: 'https://www.legalporno.com/studios/no-rest-for-the-ass', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'hairygonzo',
slug: 'hairygonzo', name: 'Hairy Gonzo',
name: 'Hairy Gonzo', url: 'https://www.legalporno.com/studios/hairy-gonzo',
url: 'https://www.legalporno.com/studios/hairy-gonzo', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'sineplexclassic',
slug: 'sineplexclassic', name: 'Sineplex Classic',
name: 'Sineplex Classic', url: 'https://www.legalporno.com/studios/sineplex-classic',
url: 'https://www.legalporno.com/studios/sineplex-classic', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'sinemale',
slug: 'sinemale', name: 'Sinemale',
name: 'Sinemale', url: 'https://www.legalporno.com/studios/sinemale',
url: 'https://www.legalporno.com/studios/sinemale', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'outsidethestudio',
slug: 'outsidethestudio', name: 'Outside The Studio',
name: 'Outside The Studio', url: 'https://www.legalporno.com/studios/outside-the-studio',
url: 'https://www.legalporno.com/studios/outside-the-studio', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, {
{ slug: 'kinkysex',
slug: 'kinkysex', name: 'Kinky Sex',
name: 'Kinky Sex', url: 'https://www.legalporno.com/studios/kinky-sex',
url: 'https://www.legalporno.com/studios/kinky-sex', parent: 'legalporno',
parent_id: networksMap.legalporno, },
}, ];
];
}
/* eslint-disable max-len */ /* eslint-disable max-len */
exports.seed = knex => Promise.resolve() exports.seed = knex => Promise.resolve()
.then(async () => { .then(async () => {
const networks = await knex('entities').select('*').where('type', 'network'); const networks = await knex('entities')
.whereIn('slug', studios.map(studio => studio.parent));
const networksMap = networks.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {}); const networksMap = networks.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const studios = getStudios(networksMap).map(studio => ({ const studiosWithNetwork = studios.map(studio => ({
...studio, slug: studio.slug,
name: studio.name,
url: studio.url,
type: 'studio', type: 'studio',
parent_id: networksMap[studio.parent],
has_logo: studio.hasLogo || false,
})); }));
return upsert('entities', studios, 'slug', knex); return upsert('entities', studiosWithNetwork, 'slug', knex);
}); });