Added dedicated movie photo table, renamed scene photo function.

This commit is contained in:
DebaucheryLibrarian
2022-03-27 23:42:03 +02:00
parent 295573c1ef
commit 15c9af8057
8 changed files with 61 additions and 36 deletions

View File

@@ -164,8 +164,8 @@ function poster() {
function photos() {
const clips = this.release.clips || [];
const clipPostersById = clips.reduce((acc, clip) => ({ ...acc, [clip.poster.id]: clip.poster }), {});
const uniqueClipPosters = Array.from(new Set(clips.map(clip => clip.poster.id) || [])).map(posterId => clipPostersById[posterId]);
const photosWithClipPosters = (this.release.photos || []).concat(uniqueClipPosters);
const uniqueClipPosters = Array.from(new Set(clips.map((clip) => clip.poster.id) || [])).map((posterId) => clipPostersById[posterId]);
const photosWithClipPosters = (this.release.photos || []).concat(this.release.scenesPhotos || []).concat(uniqueClipPosters);
if (this.release.trailer || (this.release.teaser && this.release.teaser.mime !== 'image/gif')) {
// poster will be on trailer video

View File

@@ -28,7 +28,7 @@
<Album
v-if="showAlbum"
:items="[release.poster, ...release.photos]"
:items="[release.poster, ...release.photos, ...release.scenesPhotos]"
:title="release.title"
:path="config.media.mediaPath"
@close="$router.replace({ hash: undefined })"

View File

@@ -79,6 +79,7 @@ function curateRelease(release, type = 'scene') {
if (release.series) curatedRelease.series = release.series.filter(Boolean).map(({ serie }) => curateRelease(serie, 'serie'));
if (release.chapters) curatedRelease.chapters = release.chapters.filter(Boolean).map((chapter) => curateRelease(chapter));
if (release.photos) curatedRelease.photos = release.photos.filter(Boolean).map((photo) => photo.media || photo);
if (release.scenesPhotos) curatedRelease.scenesPhotos = release.scenesPhotos.filter(Boolean).map((photo) => photo.media || photo);
if (release.covers) curatedRelease.covers = release.covers.filter(Boolean).map(({ media }) => media);
if (release.trailer) curatedRelease.trailer = release.trailer.media;
if (release.teaser) curatedRelease.teaser = release.teaser.media;

View File

@@ -442,22 +442,26 @@ const releasesFragment = `
}
`;
const mediaFragment = `
media {
const mediaFields = `
id
index
path
thumbnail
lazy
isS3
comment
sfw: sfwMedia {
id
index
path
thumbnail
lazy
isS3
path
comment
sfw: sfwMedia {
id
thumbnail
lazy
path
comment
}
}
`;
const mediaFragment = `
media {
${mediaFields}
}
`;
@@ -656,6 +660,8 @@ export {
actorFields,
actorStashesFields,
campaignsFragment,
mediaFields,
mediaFragment,
movieFields,
releaseActorsFragment,
releaseFields,

View File

@@ -4,6 +4,8 @@ import {
releaseFragment,
releaseFields,
movieFields,
mediaFragment,
mediaFields,
} from '../fragments';
import { curateRelease } from '../curate';
import getDateRange from '../get-date-range';
@@ -225,25 +227,11 @@ function initReleasesActions(store, router) {
slug
name
}
photos {
id
index
path
thumbnail
lazy
width
height
thumbnailWidth
thumbnailHeight
isS3
comment
sfw: sfwMedia {
id
thumbnail
lazy
path
comment
}
photos: moviesPhotos {
${mediaFragment}
}
scenesPhotos {
${mediaFields}
}
entity {
id