Added 'includes' argument to scrapers to help them avoid unnecessary requests. Added movie actors and movie tags views.

This commit is contained in:
ThePendulum 2020-03-09 16:54:45 +01:00
parent 638757b6e4
commit 61a795d634
5 changed files with 50 additions and 4 deletions

View File

@ -33,6 +33,7 @@ function curateRelease(release) {
if (release.trailer) curatedRelease.trailer = release.trailer.media;
if (release.teaser) curatedRelease.teaser = release.teaser.media;
if (release.actors) curatedRelease.actors = release.actors.map(({ actor }) => curateActor(actor, curatedRelease));
if (release.movieTags && release.movieTags.length > 0) curatedRelease.tags = release.movieTags.map(({ tag }) => tag);
if (release.movieActors && release.movieActors.length > 0) curatedRelease.actors = release.movieActors.map(({ actor }) => curateActor(actor, curatedRelease));
return curatedRelease;

View File

@ -169,6 +169,18 @@ const releasesFragment = `
orderBy: $orderBy,
) {
${releaseFields}
movieActors: movieActorsByMovieId(orderBy: ACTOR_BY_ACTOR_ID__GENDER_ASC) {
actor {
${actorFields}
}
}
movieTags: movieTagsByMovieId(orderBy: TAG_BY_TAG_ID__PRIORITY_DESC) {
tag {
id
name
slug
}
}
}
`;
@ -195,6 +207,13 @@ const releaseFragment = `
${actorFields}
}
}
movieTags: movieTagsByMovieId(orderBy: TAG_BY_TAG_ID__PRIORITY_DESC) {
tag {
id
name
slug
}
}
movies: releasesMoviesBySceneId {
movie {
id

View File

@ -547,7 +547,14 @@ exports.up = knex => Promise.resolve()
LEFT JOIN releases_actors ON releases_actors.release_id = releases.id
GROUP BY movie_id, actor_id;
CREATE VIEW movie_tags AS
SELECT releases_movies.movie_id, releases_tags.tag_id FROM releases_movies
LEFT JOIN releases ON releases.id = releases_movies.scene_id
LEFT JOIN releases_tags ON releases_tags.release_id = releases.id
GROUP BY movie_id, tag_id;
COMMENT ON VIEW movie_actors IS E'@foreignKey (movie_id) references releases (id)\n@foreignKey (actor_id) references actors (id)';
COMMENT ON VIEW movie_tags IS E'@foreignKey (movie_id) references releases (id)\n@foreignKey (tag_id) references tags (id)';
COMMENT ON COLUMN actors.height IS E'@omit read,update,create,delete,all,many';
COMMENT ON COLUMN actors.weight IS E'@omit read,update,create,delete,all,many';
@ -558,6 +565,7 @@ exports.down = knex => knex.raw(`
DROP FUNCTION IF EXISTS search_sites;
DROP VIEW IF EXISTS movie_actors;
DROP VIEW IF EXISTS movie_tags;
DROP TABLE IF EXISTS releases_actors CASCADE;
DROP TABLE IF EXISTS releases_movies CASCADE;

View File

@ -118,7 +118,7 @@ const tags = [
{
name: 'asian',
slug: 'asian',
priority: 7,
priority: 5,
group: 'ethnicity',
},
{
@ -342,7 +342,7 @@ const tags = [
{
name: 'ebony',
slug: 'ebony',
priority: 7,
priority: 5,
group: 'ethnicity',
},
{
@ -427,7 +427,7 @@ const tags = [
{
name: 'gaping',
slug: 'gaping',
priority: 7,
priority: 6,
},
{
name: 'gay',
@ -481,7 +481,7 @@ const tags = [
{
name: 'Latina',
slug: 'latina',
priority: 7,
priority: 5,
group: 'ethnicity',
},
{

18
src/utils/argv-include.js Normal file
View File

@ -0,0 +1,18 @@
'use strict';
function include(argv) {
return {
covers: argv.media && argv.covers,
media: argv.media,
photos: argv.media && argv.photos,
poster: argv.media && argv.posters,
posters: argv.media && argv.posters,
teaser: argv.media && argv.videos && argv.teasers,
teasers: argv.media && argv.videos && argv.teasers,
trailer: argv.media && argv.videos && argv.trailers,
trailers: argv.media && argv.videos && argv.trailers,
videos: argv.videos,
};
}
module.exports = include;