Showing movie trailers. Added internal parameter for entity visibility.
This commit is contained in:
parent
cd6318216f
commit
50570cb734
|
@ -72,12 +72,12 @@ const pageContext = inject('pageContext');
|
|||
const { pageProps } = pageContext;
|
||||
const { actor } = pageProps;
|
||||
|
||||
const photos = actor.profiles
|
||||
const photos = Object.values(Object.fromEntries(actor.profiles
|
||||
.filter((profile) => !!profile.avatar)
|
||||
.map((profile) => ({
|
||||
.map((profile) => [profile.avatar.id, {
|
||||
...profile.avatar,
|
||||
isAvatar: profile.avatar.id === actor.avatar.id,
|
||||
}));
|
||||
}])));
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -6,20 +6,6 @@
|
|||
:style="{ 'background-image': `url(${getPath(movie.poster || movie.covers[0])})` }"
|
||||
>
|
||||
<div class="banner">
|
||||
<div
|
||||
v-if="movie.trailer"
|
||||
class="trailer"
|
||||
>
|
||||
<Player
|
||||
:video="movie.trailer"
|
||||
:poster="poster"
|
||||
class="item"
|
||||
:class="{ playing }"
|
||||
@play="playing = true; paused = false;"
|
||||
@pause="playing = false; paused = true;"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<img
|
||||
v-for="cover in movie.covers"
|
||||
:key="`cover-${cover.id}`"
|
||||
|
@ -27,6 +13,20 @@
|
|||
class="cover"
|
||||
>
|
||||
|
||||
<div
|
||||
v-if="movie.trailer"
|
||||
class="trailer"
|
||||
>
|
||||
<Player
|
||||
:video="movie.trailer"
|
||||
:poster="getPath(movie.poster || movie.covers[0])"
|
||||
class="item"
|
||||
:class="{ playing }"
|
||||
@play="playing = true; paused = false;"
|
||||
@pause="playing = false; paused = true;"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="movie.photos.length > 0"
|
||||
class="album"
|
||||
|
@ -459,7 +459,7 @@ const scenes = pageContext.pageProps.scenes;
|
|||
}
|
||||
|
||||
.cover {
|
||||
height: 20rem;
|
||||
height: 21rem;
|
||||
}
|
||||
|
||||
.actors,
|
||||
|
|
|
@ -67,6 +67,10 @@ export async function fetchEntities(options) {
|
|||
if (options.type) {
|
||||
builder.where('entities.type', options.type);
|
||||
}
|
||||
|
||||
if (options.showInvisible !== true) {
|
||||
builder.where('entities.visible', true);
|
||||
}
|
||||
})
|
||||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||
.orderBy(...(options.order || ['name', 'asc']))
|
||||
|
|
|
@ -55,6 +55,7 @@ function curateMovie(rawMovie, assets) {
|
|||
// poster: curateMedia(assets.poster),
|
||||
covers: assets.covers.map((cover) => curateMedia(cover)),
|
||||
photos: assets.photos.map((photo) => curateMedia(photo)),
|
||||
trailer: curateMedia(assets.trailer),
|
||||
stashes: assets.stashes?.map((stash) => curateStash(stash)) || [],
|
||||
createdBatchId: rawMovie.created_batch_id,
|
||||
updatedBatchId: rawMovie.updated_batch_id,
|
||||
|
@ -68,8 +69,10 @@ export async function fetchMoviesById(movieIds, reqUser) {
|
|||
actors,
|
||||
directors,
|
||||
tags,
|
||||
sceneTags,
|
||||
covers,
|
||||
photos,
|
||||
trailers,
|
||||
stashes,
|
||||
} = await promiseProps({
|
||||
movies: knex('movies')
|
||||
|
@ -103,7 +106,11 @@ export async function fetchMoviesById(movieIds, reqUser) {
|
|||
.leftJoin('movies_scenes', 'movies_scenes.movie_id', 'movies.id')
|
||||
.leftJoin('releases_directors', 'releases_directors.release_id', 'movies_scenes.scene_id')
|
||||
.leftJoin('actors as directors', 'directors.id', 'releases_directors.director_id'),
|
||||
tags: knex('movies')
|
||||
tags: knex('movies_tags')
|
||||
.whereIn('movie_id', movieIds)
|
||||
.whereNotNull('tags.id')
|
||||
.leftJoin('tags', 'tags.id', 'movies_tags.tag_id'),
|
||||
sceneTags: knex('movies')
|
||||
.select('tags.id', 'tags.slug', 'tags.name', 'tags.priority', 'movies.id as movie_id')
|
||||
.distinct()
|
||||
.whereIn('movies.id', movieIds)
|
||||
|
@ -121,6 +128,9 @@ export async function fetchMoviesById(movieIds, reqUser) {
|
|||
.leftJoin('movies_scenes', 'movies_scenes.movie_id', 'movies.id')
|
||||
.leftJoin('releases_photos', 'releases_photos.release_id', 'movies_scenes.scene_id')
|
||||
.leftJoin('media', 'media.id', 'releases_photos.media_id'),
|
||||
trailers: knex('movies_trailers')
|
||||
.whereIn('movie_id', movieIds)
|
||||
.leftJoin('media', 'media.id', 'movies_trailers.media_id'),
|
||||
stashes: reqUser
|
||||
? knexOwner('stashes_movies')
|
||||
.leftJoin('stashes', 'stashes.id', 'stashes_movies.stash_id')
|
||||
|
@ -141,17 +151,22 @@ export async function fetchMoviesById(movieIds, reqUser) {
|
|||
const movieActors = actors.filter((actor) => actor.movie_id === movieId);
|
||||
const movieDirectors = directors.filter((director) => director.release_id === movieId);
|
||||
const movieTags = tags.filter((tag) => tag.movie_id === movieId);
|
||||
const movieSceneTags = sceneTags.filter((tag) => tag.movie_id === movieId);
|
||||
const movieCovers = covers.filter((cover) => cover.movie_id === movieId);
|
||||
const moviePhotos = photos.filter((photo) => photo.release_id === movieId);
|
||||
const movieTrailer = trailers.find((trailer) => trailer.movie_id === movieId);
|
||||
const movieStashes = stashes.filter((stash) => stash.movie_id === movieId);
|
||||
|
||||
const combinedTags = Object.values(Object.fromEntries(movieTags.concat(movieSceneTags).map((tag) => [tag.slug, tag]))).toSorted((tagA, tagB) => tagB.priority - tagA.priority);
|
||||
|
||||
return curateMovie(movie, {
|
||||
channel: movieChannel,
|
||||
actors: movieActors,
|
||||
directors: movieDirectors,
|
||||
tags: movieTags,
|
||||
tags: combinedTags,
|
||||
covers: movieCovers,
|
||||
photos: moviePhotos,
|
||||
trailer: movieTrailer,
|
||||
stashes: movieStashes,
|
||||
});
|
||||
}).filter(Boolean);
|
||||
|
|
2
static
2
static
|
@ -1 +1 @@
|
|||
Subproject commit 86446006a785c63e9c7a65431e9563f4a78e7ac5
|
||||
Subproject commit bade7b236ac5d28b6df8cdba42c8c519c08abe69
|
Loading…
Reference in New Issue