Added grandparent network IDs to manticore scene database.

This commit is contained in:
DebaucheryLibrarian 2024-06-04 03:49:35 +02:00
parent 74fbe29db5
commit b6a402d964
2 changed files with 8 additions and 2 deletions

View File

@ -31,6 +31,7 @@ async function fetchScenes() {
parents.id as network_id,
parents.slug as network_slug,
parents.name as network_name,
grandparents.id as parent_network_id,
COALESCE(JSON_AGG(DISTINCT (actors.id, actors.name)) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors,
COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name, tags.priority, tags_aliases.name)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
COALESCE(JSON_AGG(DISTINCT (movies_scenes.movie_id)) FILTER (WHERE movies_scenes.movie_id IS NOT NULL), '[]') as movies,
@ -43,6 +44,7 @@ async function fetchScenes() {
LEFT JOIN scenes_meta ON scenes_meta.scene_id = releases.id
LEFT JOIN entities ON releases.entity_id = entities.id
LEFT JOIN entities AS parents ON parents.id = entities.parent_id
LEFT JOIN entities AS grandparents ON grandparents.id = parents.parent_id
LEFT JOIN entities AS studios ON studios.id = releases.studio_id
LEFT JOIN releases_actors AS local_actors ON local_actors.release_id = releases.id
LEFT JOIN releases_directors AS local_directors ON local_directors.release_id = releases.id
@ -68,6 +70,7 @@ async function fetchScenes() {
parents.name,
parents.slug,
parents.alias,
grandparents.id,
entities.showcased,
parents.showcased,
studios.showcased;
@ -130,7 +133,7 @@ async function init() {
network_id: scene.network_id || undefined,
network_slug: scene.network_slug || undefined,
network_name: scene.network_name || undefined,
entity_ids: [scene.channel_id, scene.network_id].filter(Boolean), // manticore does not support OR, this allows IN
entity_ids: [scene.channel_id, scene.network_id, scene.parent_network_id].filter(Boolean), // manticore does not support OR, this allows IN
actor_ids: scene.actors.map((actor) => actor.f1),
actors: scene.actors.map((actor) => actor.f2).join(),
tag_ids: scene.tags.map((tag) => tag.f1),

View File

@ -69,6 +69,7 @@ async function updateManticoreSceneSearch(releaseIds) {
parents.id as network_id,
parents.slug as network_slug,
parents.name as network_name,
grandparents.id as parent_network_id,
COALESCE(JSON_AGG(DISTINCT (actors.id, actors.name)) FILTER (WHERE actors.id IS NOT NULL), '[]') as actors,
COALESCE(JSON_AGG(DISTINCT (tags.id, tags.name, tags.priority, tags_aliases.name)) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
COALESCE(JSON_AGG(DISTINCT (movies_scenes.movie_id)) FILTER (WHERE movies_scenes.movie_id IS NOT NULL), '[]') as movies,
@ -81,6 +82,7 @@ async function updateManticoreSceneSearch(releaseIds) {
LEFT JOIN scenes_meta ON scenes_meta.scene_id = releases.id
LEFT JOIN entities ON releases.entity_id = entities.id
LEFT JOIN entities AS parents ON parents.id = entities.parent_id
LEFT JOIN entities AS grandparents ON grandparents.id = parents.parent_id
LEFT JOIN entities AS studios ON studios.id = releases.studio_id
LEFT JOIN releases_actors AS local_actors ON local_actors.release_id = releases.id
LEFT JOIN releases_directors AS local_directors ON local_directors.release_id = releases.id
@ -108,6 +110,7 @@ async function updateManticoreSceneSearch(releaseIds) {
parents.name,
parents.slug,
parents.alias,
grandparents.id,
parents.showcased,
studios.showcased
`, releaseIds && [releaseIds]);
@ -137,7 +140,7 @@ async function updateManticoreSceneSearch(releaseIds) {
network_id: scene.network_id || undefined,
network_slug: scene.network_slug || undefined,
network_name: scene.network_name || undefined,
entity_ids: [scene.channel_id, scene.network_id].filter(Boolean), // manticore does not support OR, this allows IN
entity_ids: [scene.channel_id, scene.network_id, scene.parent_network_id].filter(Boolean), // manticore does not support OR, this allows IN
actor_ids: scene.actors.map((actor) => actor.f1),
actors: scene.actors.map((actor) => actor.f2).join(),
tag_ids: scene.tags.map((tag) => tag.f1),