Showing actors, tags and date on movie tiles.

This commit is contained in:
DebaucheryLibrarian 2020-08-10 21:39:55 +02:00
parent dd1ea597d4
commit 40aed1086f
23 changed files with 273 additions and 17 deletions

View File

@ -43,7 +43,7 @@ export default {
.tiles {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
grid-template-columns: repeat(auto-fill, minmax(25rem, 1fr));
grid-gap: 1rem;
}
</style>

View File

@ -12,16 +12,96 @@
</router-link>
<div class="info">
<div class="details">
<span
v-if="movie.entity.type !== 'network' && !movie.entity.independent && movie.entity.parent"
class="entity"
>
<router-link
v-tooltip.bottom="`Part of ${movie.entity.parent.name}`"
:title="`Part of ${movie.entity.parent.name}`"
:to="`/${movie.entity.parent.type}/${movie.entity.parent.slug}`"
class="entity-link"
><img
:src="`/img/logos/${movie.entity.parent.slug}/favicon.png`"
class="favicon"
></router-link>
<router-link
v-tooltip.bottom="`More from ${movie.entity.name}`"
:title="`More from ${movie.entity.name}`"
:to="`/${movie.entity.type}/${movie.entity.slug}`"
class="entity-link"
>{{ movie.entity.name }}</router-link>
</span>
<router-link
v-else
:to="`/${movie.entity.type}/${movie.entity.slug}`"
class="entity entity-link"
><img
:src="`/img/logos/${movie.entity.slug}/favicon.png`"
class="favicon"
>{{ movie.entity.name }}</router-link>
<a
v-if="movie.date"
v-tooltip.bottom="movie.url && `View movie on ${movie.entity.name}`"
:title="movie.url && `View movie on ${movie.entity.name}`"
:href="movie.url"
:class="{ upcoming: isAfter(movie.date, new Date()) }"
target="_blank"
rel="noopener noreferrer"
class="date"
><Icon icon="share2" />{{ formatDate(movie.date, 'MMMM D, YYYY', movie.datePrecision) }}</a>
<a
v-else
:href="movie.url"
:class="{ upcoming: isAfter(movie.date, new Date()), new: movie.isNew }"
title="Scene date N/A, showing date added"
target="_blank"
rel="noopener noreferrer"
class="date"
>{{ `(${formatDate(movie.dateAdded, 'MMMM D, YYYY')})` }}</a>
</div>
<router-link
:to="{ name: 'movie', params: { movieId: movie.id, movieSlug: movie.slug } }"
class="title-link"
>
<h3 class="title">{{ movie.title }}</h3>
</router-link>
</div>
</div>
<div class="details">{{ movie.entity.name }}</div>
<ul
class="actors nolist"
:title="movie.actors.map(actor => actor.name).join(', ')"
>
<li
v-for="actor in movie.actors"
:key="`tag-${movie.id}-${actor.id}`"
class="actor"
><router-link
:to="`/actor/${actor.id}/${actor.slug}`"
class="actor-link"
>{{ actor.name }}</router-link></li>
</ul>
<ul
class="tags nolist"
:title="movie.tags.map(tag => tag.name).join(', ')"
>
<li
v-for="tag in movie.tags"
:key="`tag-${movie.id}-${tag.id}`"
class="tag"
><router-link
:to="`/tag/${tag.slug}`"
class="tag-link"
>{{ tag.name }}</router-link></li>
</ul>
</div>
</div>
</div>
</template>
@ -41,7 +121,7 @@ export default {
display: flex;
flex-direction: column;
background: var(--background);
box-shadow: 0 0 3px var(--darken);
box-shadow: 0 0 3px var(--darken-weak);
font-size: 0;
}
@ -55,6 +135,9 @@ export default {
}
.details {
display: flex;
justify-content: space-between;
align-items: center;
color: var(--text-light);
background: var(--profile);
padding: .5rem 1rem;
@ -62,17 +145,101 @@ export default {
font-weight: bold;
}
.entity-link,
.date {
display: flex;
align-items: center;
color: inherit;
font-size: inherit;
text-decoration: none;
.favicon {
width: 1rem;
height: 1rem;
margin: 0 .5rem 0 0;
}
.icon {
fill: var(--highlight-weak);
margin: 0 .25rem 0 0;
}
&:hover .icon {
fill: var(--text-light);
}
}
.cover {
width: 12rem;
height: 16rem;
box-shadow: 0 0 3px var(--darken-weak);
img {
width: 100%;
height: 100%;
max-width: 12rem;
object-fit: cover;
object-position: center ;
}
}
.info {
flex-grow: 1;
overflow: hidden;
}
.title {
box-sizing: border-box;
padding: 1rem;
margin: 0;
font-size: 1rem;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.actors {
padding: 0 1rem;
margin: 0 0 1rem 0;
line-height: 1.5;
}
.actor:not(:last-child)::after {
content: ',';
margin: 0 .25rem 0 0;
font-size: 1rem;
}
.actor-link {
font-size: 1rem;
color: var(--link);
text-decoration: none;
&:hover {
color: var(--primary);
}
}
.tags {
padding: .2rem 1rem 0 1rem;
height: 1.75rem;
line-height: 2;
overflow: hidden;
}
.tag {
margin: 0 0 .5rem 0;
}
.tag-link {
background: var(--background);
font-size: .75rem;
padding: .25rem .5rem;
color: var(--shadow);
font-weight: bold;
text-decoration: none;
box-shadow: 0 0 3px var(--shadow-weak);
&:hover {
color: var(--primary);
}
}
</style>

View File

@ -123,7 +123,7 @@ export default {
}
.title {
padding: .75rem 1rem;
padding: .5rem 1rem;
margin: 0;
flex-shrink: 0;
text-transform: capitalize;

View File

@ -64,7 +64,7 @@ function curateRelease(release) {
...release,
actors: [],
poster: release.poster && release.poster.media,
tags: release.tags ? release.tags.map(({ tag }) => tag) : [],
tags: release.tags ? release.tags.map(tag => tag.tag || tag) : [],
};
if (release.scenes) curatedRelease.scenes = release.scenes.map(({ scene }) => curateRelease(scene));
@ -73,7 +73,7 @@ function curateRelease(release) {
if (release.covers) curatedRelease.covers = release.covers.map(({ media }) => media);
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.actors) curatedRelease.actors = release.actors.map(actor => curateActor(actor.actor || 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));

View File

@ -65,10 +65,27 @@ function initReleasesActions(store, _router) {
slug
date
datePrecision
actors {
id
name
slug
}
tags {
id
name
slug
}
entity {
id
name
slug
type
parent {
id
name
slug
type
}
}
covers: moviesCoversByReleaseId {
media {

View File

@ -958,6 +958,36 @@ exports.up = knex => Promise.resolve()
END;
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION movies_actors(movie movies) RETURNS SETOF actors AS $$
SELECT actors.*
FROM movies_scenes
LEFT JOIN
releases ON releases.id = movies_scenes.scene_id
LEFT JOIN
releases_actors ON releases_actors.release_id = releases.id
LEFT JOIN
actors ON actors.id = releases_actors.actor_id
WHERE movies_scenes.movie_id = movie.id
AND actors.id IS NOT NULL
GROUP BY actors.id
ORDER BY actors.name, actors.gender
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION movies_tags(movie movies) RETURNS SETOF tags AS $$
SELECT tags.*
FROM movies_scenes
LEFT JOIN
releases ON releases.id = movies_scenes.scene_id
LEFT JOIN
releases_tags ON releases_tags.release_id = releases.id
LEFT JOIN
tags ON tags.id = releases_tags.tag_id
WHERE movies_scenes.movie_id = movie.id
AND tags.id IS NOT NULL
GROUP BY tags.id
ORDER BY tags.priority DESC
$$ LANGUAGE SQL STABLE;
CREATE FUNCTION releases_is_new(release releases) RETURNS boolean AS $$
SELECT EXISTS(SELECT true WHERE (SELECT id FROM batches ORDER BY created_at DESC LIMIT 1) = release.created_batch_id);
$$ LANGUAGE sql STABLE;
@ -1038,6 +1068,9 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
DROP FUNCTION IF EXISTS actors_channels;
DROP FUNCTION IF EXISTS actors_scenes;
DROP FUNCTION IF EXISTS movies_actors;
DROP FUNCTION IF EXISTS movies_tags;
DROP TEXT SEARCH CONFIGURATION IF EXISTS traxxx;
DROP TEXT SEARCH DICTIONARY IF EXISTS traxxx_dict;
`);

BIN
public/img/tags/dap/8.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -686,6 +686,7 @@ const tagPhotos = [
['dap', 2, 'Lana Rhoades in "Lana Rhoades Unleashed" for HardX'],
['dap', 6, 'Sheena Shaw in "Ass Worship 14" for Jules Jordan'],
['dap', 5, 'Riley Reid in "The Gangbang of Riley Reid" for Jules Jordan'],
['dap', 8, 'Lady Gang in SZ2478 LegalPorno'],
['dap', 'poster', 'Haley Reed in "Young Hot Ass" for Evil Angel'],
['dap', 0, 'Nicole Black doing double anal during a gangbang in GIO971 for LegalPorno'],
['dap', 1, 'Ria Sunn in SZ1801 for LegalPorno'],

View File

@ -49,12 +49,14 @@ async function init() {
}
if (argv.save) {
if (deepScenes.length + deepMovieScenes.length > 0) {
await storeScenes(deepScenes.concat(deepMovieScenes));
if (deepScenes.length > 0 || deepMovieScenes.length > 0) {
await storeScenes(deepScenes || []);
}
if (deepMovies.length > 0) {
await storeMovies(deepMovies);
const storedMovieScenes = await storeScenes(deepMovieScenes);
await storeMovies(deepMovies, storedMovieScenes);
}
}

View File

@ -165,7 +165,9 @@ async function fetchScenes(baseReleasesOrUrls) {
}
async function fetchMovies(baseReleasesOrUrls) {
return fetchReleases(baseReleasesOrUrls, 'movie');
const movies = await fetchReleases(baseReleasesOrUrls, 'movie');
return movies;
}
module.exports = {

View File

@ -255,7 +255,38 @@ async function storeScenes(releases) {
return releasesWithId;
}
async function storeMovies(movies) {
async function associateMovieScenes(movies, movieScenes) {
const movieScenesByEntityIdAndEntryId = movieScenes.reduce((acc, scene) => ({
...acc,
[scene.entity.id]: {
...acc[scene.entity.id],
[scene.entryId]: scene,
},
}), {});
const associations = movies.map((movie) => {
if (!movie.scenes) {
return null;
}
return movie.scenes.map((scene) => {
const movieScene = movieScenesByEntityIdAndEntryId[movie.entity.id]?.[scene.entryId];
if (movieScene) {
return {
movie_id: movie.id,
scene_id: movieScene.id,
};
}
return null;
});
}).flat().filter(Boolean);
await knex.batchInsert('movies_scenes', associations);
}
async function storeMovies(movies, movieScenes) {
const { uniqueReleases } = await filterDuplicateReleases(movies);
const [batchId] = await knex('batches').insert({ comment: null }).returning('id');
@ -264,6 +295,7 @@ async function storeMovies(movies) {
const moviesWithId = attachReleaseIds(movies, storedMovies);
await associateMovieScenes(moviesWithId, movieScenes);
await associateReleaseMedia(moviesWithId, 'movies');
return storedMovies;

View File

@ -177,7 +177,7 @@ async function scrapeMovies(scraper, entity) {
}
async function scrapeChannelReleases(scraper, channelEntity, preData) {
const [latestReleases, upcomingReleases] = await Promise.all([
const [latestReleases, upcomingReleases, movies] = await Promise.all([
argv.latest
? scrapeLatestReleases(scraper, channelEntity, preData)
: [],
@ -189,6 +189,8 @@ async function scrapeChannelReleases(scraper, channelEntity, preData) {
: [],
]);
console.log(movies);
logger.info(`Fetching ${latestReleases.length} latest and ${upcomingReleases.length} upcoming updates for '${channelEntity.name}' (${channelEntity.parent?.name})`);
return [...latestReleases, ...upcomingReleases];