forked from DebaucheryLibrarian/traxxx
Added 'includes' argument to scrapers to help them avoid unnecessary requests. Added movie actors and movie tags views.
This commit is contained in:
parent
638757b6e4
commit
61a795d634
|
@ -33,6 +33,7 @@ function curateRelease(release) {
|
||||||
if (release.trailer) curatedRelease.trailer = release.trailer.media;
|
if (release.trailer) curatedRelease.trailer = release.trailer.media;
|
||||||
if (release.teaser) curatedRelease.teaser = release.teaser.media;
|
if (release.teaser) curatedRelease.teaser = release.teaser.media;
|
||||||
if (release.actors) curatedRelease.actors = release.actors.map(({ actor }) => curateActor(actor, curatedRelease));
|
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));
|
if (release.movieActors && release.movieActors.length > 0) curatedRelease.actors = release.movieActors.map(({ actor }) => curateActor(actor, curatedRelease));
|
||||||
|
|
||||||
return curatedRelease;
|
return curatedRelease;
|
||||||
|
|
|
@ -169,6 +169,18 @@ const releasesFragment = `
|
||||||
orderBy: $orderBy,
|
orderBy: $orderBy,
|
||||||
) {
|
) {
|
||||||
${releaseFields}
|
${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}
|
${actorFields}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
movieTags: movieTagsByMovieId(orderBy: TAG_BY_TAG_ID__PRIORITY_DESC) {
|
||||||
|
tag {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
slug
|
||||||
|
}
|
||||||
|
}
|
||||||
movies: releasesMoviesBySceneId {
|
movies: releasesMoviesBySceneId {
|
||||||
movie {
|
movie {
|
||||||
id
|
id
|
||||||
|
|
|
@ -547,7 +547,14 @@ exports.up = knex => Promise.resolve()
|
||||||
LEFT JOIN releases_actors ON releases_actors.release_id = releases.id
|
LEFT JOIN releases_actors ON releases_actors.release_id = releases.id
|
||||||
GROUP BY movie_id, actor_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_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.height IS E'@omit read,update,create,delete,all,many';
|
||||||
COMMENT ON COLUMN actors.weight 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 FUNCTION IF EXISTS search_sites;
|
||||||
|
|
||||||
DROP VIEW IF EXISTS movie_actors;
|
DROP VIEW IF EXISTS movie_actors;
|
||||||
|
DROP VIEW IF EXISTS movie_tags;
|
||||||
|
|
||||||
DROP TABLE IF EXISTS releases_actors CASCADE;
|
DROP TABLE IF EXISTS releases_actors CASCADE;
|
||||||
DROP TABLE IF EXISTS releases_movies CASCADE;
|
DROP TABLE IF EXISTS releases_movies CASCADE;
|
||||||
|
|
|
@ -118,7 +118,7 @@ const tags = [
|
||||||
{
|
{
|
||||||
name: 'asian',
|
name: 'asian',
|
||||||
slug: 'asian',
|
slug: 'asian',
|
||||||
priority: 7,
|
priority: 5,
|
||||||
group: 'ethnicity',
|
group: 'ethnicity',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -342,7 +342,7 @@ const tags = [
|
||||||
{
|
{
|
||||||
name: 'ebony',
|
name: 'ebony',
|
||||||
slug: 'ebony',
|
slug: 'ebony',
|
||||||
priority: 7,
|
priority: 5,
|
||||||
group: 'ethnicity',
|
group: 'ethnicity',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -427,7 +427,7 @@ const tags = [
|
||||||
{
|
{
|
||||||
name: 'gaping',
|
name: 'gaping',
|
||||||
slug: 'gaping',
|
slug: 'gaping',
|
||||||
priority: 7,
|
priority: 6,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'gay',
|
name: 'gay',
|
||||||
|
@ -481,7 +481,7 @@ const tags = [
|
||||||
{
|
{
|
||||||
name: 'Latina',
|
name: 'Latina',
|
||||||
slug: 'latina',
|
slug: 'latina',
|
||||||
priority: 7,
|
priority: 5,
|
||||||
group: 'ethnicity',
|
group: 'ethnicity',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue