Showing movie covers as poster when available.

This commit is contained in:
ThePendulum 2019-12-13 03:57:01 +01:00
parent 73f9d568b0
commit e69b7744c8
7 changed files with 56 additions and 545 deletions

View File

@ -1,102 +0,0 @@
<template>
<div
class="banner"
@wheel.prevent="scrollBanner"
>
<div class="trailer">
<video
v-if="release.trailer"
:src="`/media/${release.trailer.path}`"
:poster="`/media/${(release.poster && release.poster.thumbnail) || (release.photos.length && release.photos[Math.floor(Math.random() * release.photos.length)].path)}`"
:alt="release.title"
class="item trailer-video"
controls
>Sorry, the tailer cannot be played in your browser</video>
</div>
<a
v-for="photo in photos"
:key="`banner-${photo.index}`"
:href="`/media/${photo.path}`"
target="_blank"
rel="noopener noreferrer"
>
<img
:src="`/media/${photo.thumbnail}`"
:alt="`Photo ${photo.index + 1}`"
class="item"
>
</a>
</div>
</template>
<script>
function photos() {
if (this.release.photos.length) {
const set = this.release.photos.sort(({ index: indexA }, { index: indexB }) => indexA - indexB);
if (this.release.trailer) {
return set;
}
return [this.release.poster].concat(set);
}
if (this.release.poster && !this.release.trailer) {
return [this.release.poster];
}
return [];
}
function scrollBanner(event) {
event.currentTarget.scrollLeft += event.deltaY; // eslint-disable-line no-param-reassign
}
export default {
props: {
release: {
type: Object,
default: null,
},
},
computed: {
photos,
},
methods: {
scrollBanner,
},
};
</script>
<style lang="scss" scoped>
@import 'theme';
.banner {
background: $empty;
flex-shrink: 0;
white-space: nowrap;
overflow-x: auto;
scrollbar-width: none;
box-shadow: 0 0 3px $shadow;
font-size: 0;
&::-webkit-scrollbar {
display: none;
}
}
.trailer {
display: inline-block;
max-width: 100vw;
}
.trailer-video {
max-width: 100%;
}
.item {
height: 18rem;
vertical-align: middle;
}
</style>

View File

@ -1,398 +0,0 @@
<template>
<div
v-if="release"
class="content"
>
<Banner :release="release" />
<div class="info">
<div class="column">
<a
v-if="release.date"
v-tooltip.bottom="release.url && `View scene on ${release.site.name}`"
:title="release.url && `View scene on ${release.site.name}`"
:href="release.url"
:class="{ link: release.url }"
target="_blank"
rel="noopener noreferrer"
class="tidbit date"
>
<Icon
v-if="isAfter(new Date(), release.date)"
icon="calendar2"
/>
<Icon
v-else
v-tooltip.bottom="'To be released'"
icon="sun3"
/>
<span class="showable">{{ formatDate(release.date, 'MMM D, YYYY') }}</span>
<span class="hideable">{{ formatDate(release.date, 'MMMM D, YYYY') }}</span>
</a>
<span
v-if="release.shootId"
v-tooltip.bottom="`Shoot #`"
class="tidbit shoot hideable"
>
<Icon icon="clapboard-play" />
{{ release.shootId }}
</span>
<span
v-if="release.duration"
v-tooltip.bottom="`Duration`"
class="tidbit duration hideable"
>
<Icon icon="stopwatch" />
<span
v-if="release.duration >= 3600"
class="duration-segment"
>{{ Math.floor(release.duration / 3600) }}:</span>
<span class="duration-segment">{{ Math.floor((release.duration % 3600) / 60).toString().padStart(2, '0') }}:</span>
<span class="duration-segment">{{ (release.duration % 60).toString().padStart(2, '0') }}</span>
</span>
<span class="tidbit site">
<a
v-if="release.site.independent"
:href="`/network/${release.network.slug}`"
>
<img
:src="`/img/logos/${release.network.slug}/network.png`"
:title="release.network.name"
class="logo logo-site"
>
</a>
<template v-else>
<a :href="`/network/${release.network.slug}`">
<img
:src="`/img/logos/${release.network.slug}/network.png`"
:title="release.network.name"
:alt="release.network.name"
class="logo logo-network"
>
</a>
<span class="chain">presents</span>
<a :href="`/site/${release.site.slug}`">
<img
:src="`/img/logos/${release.network.slug}/${release.site.slug}.png`"
:title="release.site.name"
class="logo logo-site"
>
</a>
</template>
</span>
</div>
</div>
<div class="column">
<h2 class="row title">{{ release.title }}</h2>
<div class="row">
<ul class="actors nolist">
<li
v-for="actor in release.actors"
:key="actor.id"
class="actor"
>
<Actor :actor="actor" />
</li>
</ul>
</div>
<div
v-if="release.tags.length > 0"
class="row"
>
<Icon icon="price-tags3" />
<ul class="tags nolist">
<li
v-for="tag in release.tags"
:key="`tag-${tag.slug}`"
class="tag"
>
<a
:href="`/tag/${tag.slug}`"
class="link"
>{{ tag.name }}</a>
</li>
</ul>
</div>
<div
v-if="release.duration"
class="row duration showable"
>
<Icon icon="stopwatch" />
<span
v-if="release.duration >= 3600"
class="duration-segment"
>{{ Math.floor(release.duration / 3600) }}:</span>
<span class="duration-segment">{{ Math.floor((release.duration % 3600) / 60).toString().padStart(2, '0') }}:</span>
<span class="duration-segment">{{ (release.duration % 60).toString().padStart(2, '0') }}</span>
</div>
<p
v-if="release.description"
class="row description"
>
<Icon icon="info2" />
{{ release.description }}
</p>
<div
v-if="release.studio"
class="row"
>
<Icon icon="video-camera2" />
<a
v-if="release.studio"
:href="release.studio.url"
target="_blank"
rel="noopener noreferrer"
class="link"
>{{ release.studio.name }}</a>
</div>
<div
v-if="release.shootId"
class="row showable"
>
<Icon icon="clapboard-play" />
<a
:href="release.url"
:title="`release.shootId`"
target="_blank"
rel="noopener noreferrer"
class="link shoot"
>{{ release.shootId }}</a>
</div>
<span class="row">
<Icon icon="drawer-in" />
<a
:href="`/added/${formatDate(release.dateAdded, 'YYYY-MM-DD')}`"
:title="`Added on ${formatDate(release.dateAdded, 'MMMM D, YYYY')}`"
target="_blank"
rel="noopener noreferrer"
class="link added"
>{{ formatDate(release.dateAdded, 'MMMM D, YYYY') }}</a>
</span>
</div>
</div>
</template>
<script>
import Actor from '../tile/actor.vue';
import Banner from './banner.vue';
function pageTitle() {
return this.release && this.release.title;
}
async function mounted() {
this.release = await this.$store.dispatch('fetchReleaseById', this.$route.params.releaseId);
}
export default {
components: {
Actor,
Banner,
},
data() {
return {
release: null,
};
},
computed: {
pageTitle,
},
mounted,
};
</script>
<style lang="scss" scoped>
@import 'theme';
.column {
width: 1200px;
max-width: 100%;
padding: 0 1rem;
margin: 0 auto;
box-sizing: border-box;
}
.row {
display: flex;
align-items: center;
margin: 0 0 1rem 0;
.icon {
display: inline-block;
width: 1rem;
fill: $shadow-strong;
margin: 0 1rem 0 0;
}
}
.info {
background: $background;
margin: 0 0 1.5rem 0;
box-shadow: 0 0 3px $shadow-weak;
cursor: default;
.column {
display: flex;
align-items: center;
padding: 0 1rem;
}
}
.tidbit {
display: inline-block;
height: 100%;
&:not(:last-child) {
border-right: solid 1px $shadow-hint;
}
.icon {
fill: $shadow-strong;
margin: 0 .25rem 0 0;
}
&.date,
&.duration,
&.shoot {
flex-shrink: 0;
padding: 1.25rem 1rem 1.25rem 0;
margin: 0 1rem 0 0;
}
}
.site {
display: inline-flex;
flex-grow: 1;
align-items: center;
justify-content: flex-end;
padding: .25rem 0;
font-size: 0;
}
.logo {
display: inline-block;
filter: $logo-outline;
}
.logo-site {
height: 3rem;
max-width: 15rem;
object-fit: contain;
object-position: 100% 50%;
}
.logo-network {
height: 1.5rem;
max-width: 10rem;
object-fit: contain;
object-position: 100% 50%;
}
.chain {
color: $shadow;
padding: 0 .5rem;
font-weight: bold;
font-size: .8rem;
}
.title {
margin: 0 0 1.5rem 0;
}
.description {
line-height: 1.25;
}
.duration {
font-size: 0;
}
.duration-segment {
font-size: 1rem;
}
.actors {
display: flex;
flex-wrap: wrap;
}
.link {
display: inline-block;
color: $link;
text-decoration: none;
&:hover {
color: $primary;
.icon {
fill: $primary;
}
}
}
.tag .link {
background: $background;
display: inline-block;
padding: .5rem;
margin: 0 .25rem .25rem 0;
box-shadow: 0 0 2px $shadow-weak;
text-decoration: none;
text-transform: capitalize;
&:hover {
color: $primary;
}
}
.showable {
display: none;
}
@media(max-width: $breakpoint3) {
.logo-network,
.chain {
display: none;
}
}
@media(max-width: $breakpoint) {
.hideable {
display: none;
}
.row .showable {
display: block;
}
.tidbit .showable {
display: inline-block;
}
.logo-site {
width: 15rem;
max-width: 100%;
}
}
</style>

View File

@ -49,6 +49,13 @@
class="thumbnail" class="thumbnail"
> >
<img
v-else-if="release.covers"
:src="`/media/${release.covers[0].thumbnail}`"
:alt="release.title"
class="thumbnail"
>
<img <img
v-else-if="release.photos.length > 0" v-else-if="release.photos.length > 0"
:src="`/media/${release.photos[0].thumbnail}`" :src="`/media/${release.photos[0].thumbnail}`"

View File

@ -2,7 +2,7 @@ import Vue from 'vue';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';
import Home from '../components/home/home.vue'; import Home from '../components/home/home.vue';
import Release from '../components/release/release.vue'; import Release from '../components/releases/release.vue';
import Site from '../components/site/site.vue'; import Site from '../components/site/site.vue';
import Network from '../components/networks/network.vue'; import Network from '../components/networks/network.vue';
import Networks from '../components/networks/networks.vue'; import Networks from '../components/networks/networks.vue';

View File

@ -328,7 +328,7 @@
} }
/* $primary: #ff886c; */ /* $primary: #ff886c; */
.banner[data-v-cbb14462] { .banner[data-v-42bb19c4] {
background: #222; background: #222;
flex-shrink: 0; flex-shrink: 0;
white-space: nowrap; white-space: nowrap;
@ -337,72 +337,72 @@
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5); box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
font-size: 0; font-size: 0;
} }
.banner[data-v-cbb14462]::-webkit-scrollbar { .banner[data-v-42bb19c4]::-webkit-scrollbar {
display: none; display: none;
} }
.trailer[data-v-cbb14462] { .trailer[data-v-42bb19c4] {
display: inline-block; display: inline-block;
max-width: 100vw; max-width: 100vw;
} }
.trailer-video[data-v-cbb14462] { .trailer-video[data-v-42bb19c4] {
max-width: 100%; max-width: 100%;
} }
.item[data-v-cbb14462] { .item[data-v-42bb19c4] {
height: 18rem; height: 18rem;
vertical-align: middle; vertical-align: middle;
} }
/* $primary: #ff886c; */ /* $primary: #ff886c; */
.column[data-v-2bc41e74] { .column[data-v-d4b03dc2] {
width: 1200px; width: 1200px;
max-width: 100%; max-width: 100%;
padding: 0 1rem; padding: 0 1rem;
margin: 0 auto; margin: 0 auto;
box-sizing: border-box; box-sizing: border-box;
} }
.row[data-v-2bc41e74] { .row[data-v-d4b03dc2] {
display: -webkit-box; display: -webkit-box;
display: flex; display: flex;
-webkit-box-align: center; -webkit-box-align: center;
align-items: center; align-items: center;
margin: 0 0 1rem 0; margin: 0 0 1rem 0;
} }
.row .icon[data-v-2bc41e74] { .row .icon[data-v-d4b03dc2] {
display: inline-block; display: inline-block;
width: 1rem; width: 1rem;
fill: rgba(0, 0, 0, 0.7); fill: rgba(0, 0, 0, 0.7);
margin: 0 1rem 0 0; margin: 0 1rem 0 0;
} }
.info[data-v-2bc41e74] { .info[data-v-d4b03dc2] {
background: #fff; background: #fff;
margin: 0 0 1.5rem 0; margin: 0 0 1.5rem 0;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.2); box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
cursor: default; cursor: default;
} }
.info .column[data-v-2bc41e74] { .info .column[data-v-d4b03dc2] {
display: -webkit-box; display: -webkit-box;
display: flex; display: flex;
-webkit-box-align: center; -webkit-box-align: center;
align-items: center; align-items: center;
padding: 0 1rem; padding: 0 1rem;
} }
.tidbit[data-v-2bc41e74] { .tidbit[data-v-d4b03dc2] {
display: inline-block; display: inline-block;
height: 100%; height: 100%;
} }
.tidbit[data-v-2bc41e74]:not(:last-child) { .tidbit[data-v-d4b03dc2]:not(:last-child) {
border-right: solid 1px rgba(0, 0, 0, 0.1); border-right: solid 1px rgba(0, 0, 0, 0.1);
} }
.tidbit .icon[data-v-2bc41e74] { .tidbit .icon[data-v-d4b03dc2] {
fill: rgba(0, 0, 0, 0.7); fill: rgba(0, 0, 0, 0.7);
margin: 0 .25rem 0 0; margin: 0 .25rem 0 0;
} }
.tidbit.date[data-v-2bc41e74], .tidbit.duration[data-v-2bc41e74], .tidbit.shoot[data-v-2bc41e74] { .tidbit.date[data-v-d4b03dc2], .tidbit.duration[data-v-d4b03dc2], .tidbit.shoot[data-v-d4b03dc2] {
flex-shrink: 0; flex-shrink: 0;
padding: 1.25rem 1rem 1.25rem 0; padding: 1.25rem 1rem 1.25rem 0;
margin: 0 1rem 0 0; margin: 0 1rem 0 0;
} }
.site[data-v-2bc41e74] { .site[data-v-d4b03dc2] {
display: -webkit-inline-box; display: -webkit-inline-box;
display: inline-flex; display: inline-flex;
-webkit-box-flex: 1; -webkit-box-flex: 1;
@ -414,12 +414,12 @@
padding: .25rem 0; padding: .25rem 0;
font-size: 0; font-size: 0;
} }
.logo[data-v-2bc41e74] { .logo[data-v-d4b03dc2] {
display: inline-block; display: inline-block;
-webkit-filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.2)); -webkit-filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.2));
filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.2)); filter: drop-shadow(1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2)) drop-shadow(0 -1px 0 rgba(0, 0, 0, 0.2));
} }
.logo-site[data-v-2bc41e74] { .logo-site[data-v-d4b03dc2] {
height: 3rem; height: 3rem;
max-width: 15rem; max-width: 15rem;
-o-object-fit: contain; -o-object-fit: contain;
@ -427,7 +427,7 @@
-o-object-position: 100% 50%; -o-object-position: 100% 50%;
object-position: 100% 50%; object-position: 100% 50%;
} }
.logo-network[data-v-2bc41e74] { .logo-network[data-v-d4b03dc2] {
height: 1.5rem; height: 1.5rem;
max-width: 10rem; max-width: 10rem;
-o-object-fit: contain; -o-object-fit: contain;
@ -435,41 +435,41 @@
-o-object-position: 100% 50%; -o-object-position: 100% 50%;
object-position: 100% 50%; object-position: 100% 50%;
} }
.chain[data-v-2bc41e74] { .chain[data-v-d4b03dc2] {
color: rgba(0, 0, 0, 0.5); color: rgba(0, 0, 0, 0.5);
padding: 0 .5rem; padding: 0 .5rem;
font-weight: bold; font-weight: bold;
font-size: .8rem; font-size: .8rem;
} }
.title[data-v-2bc41e74] { .title[data-v-d4b03dc2] {
margin: 0 0 1.5rem 0; margin: 0 0 1.5rem 0;
} }
.description[data-v-2bc41e74] { .description[data-v-d4b03dc2] {
line-height: 1.25; line-height: 1.25;
} }
.duration[data-v-2bc41e74] { .duration[data-v-d4b03dc2] {
font-size: 0; font-size: 0;
} }
.duration-segment[data-v-2bc41e74] { .duration-segment[data-v-d4b03dc2] {
font-size: 1rem; font-size: 1rem;
} }
.actors[data-v-2bc41e74] { .actors[data-v-d4b03dc2] {
display: -webkit-box; display: -webkit-box;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.link[data-v-2bc41e74] { .link[data-v-d4b03dc2] {
display: inline-block; display: inline-block;
color: #cc4466; color: #cc4466;
text-decoration: none; text-decoration: none;
} }
.link[data-v-2bc41e74]:hover { .link[data-v-d4b03dc2]:hover {
color: #ff6c88; color: #ff6c88;
} }
.link:hover .icon[data-v-2bc41e74] { .link:hover .icon[data-v-d4b03dc2] {
fill: #ff6c88; fill: #ff6c88;
} }
.tag .link[data-v-2bc41e74] { .tag .link[data-v-d4b03dc2] {
background: #fff; background: #fff;
display: inline-block; display: inline-block;
padding: .5rem; padding: .5rem;
@ -478,29 +478,29 @@
text-decoration: none; text-decoration: none;
text-transform: capitalize; text-transform: capitalize;
} }
.tag .link[data-v-2bc41e74]:hover { .tag .link[data-v-d4b03dc2]:hover {
color: #ff6c88; color: #ff6c88;
} }
.showable[data-v-2bc41e74] { .showable[data-v-d4b03dc2] {
display: none; display: none;
} }
@media (max-width: 1200px) { @media (max-width: 1200px) {
.logo-network[data-v-2bc41e74], .logo-network[data-v-d4b03dc2],
.chain[data-v-2bc41e74] { .chain[data-v-d4b03dc2] {
display: none; display: none;
} }
} }
@media (max-width: 720px) { @media (max-width: 720px) {
.hideable[data-v-2bc41e74] { .hideable[data-v-d4b03dc2] {
display: none; display: none;
} }
.row .showable[data-v-2bc41e74] { .row .showable[data-v-d4b03dc2] {
display: block; display: block;
} }
.tidbit .showable[data-v-2bc41e74] { .tidbit .showable[data-v-d4b03dc2] {
display: inline-block; display: inline-block;
} }
.logo-site[data-v-2bc41e74] { .logo-site[data-v-d4b03dc2] {
width: 15rem; width: 15rem;
max-width: 100%; max-width: 100%;
} }

View File

@ -80,6 +80,7 @@ async function curateRelease(release) {
duration: release.duration, duration: release.duration,
photos: media.filter(item => item.role === 'photo'), photos: media.filter(item => item.role === 'photo'),
poster: media.filter(item => item.role === 'poster')[0], poster: media.filter(item => item.role === 'poster')[0],
covers: media.filter(item => item.role === 'cover'),
trailer: media.filter(item => item.role === 'trailer')[0], trailer: media.filter(item => item.role === 'trailer')[0],
site: { site: {
id: release.site_id, id: release.site_id,
@ -244,26 +245,30 @@ async function fetchTagReleases(queryObject, options = {}) {
async function storeReleaseAssets(release, releaseId) { async function storeReleaseAssets(release, releaseId) {
const subpath = `${release.site.network.slug}/${release.site.slug}/${release.id}/`; const subpath = `${release.site.network.slug}/${release.site.slug}/${release.id}/`;
const identifier = `"${release.title}" (${releaseId})`;
await createMediaDirectory('releases', subpath); await createMediaDirectory('releases', subpath);
console.log(release.poster);
try { try {
await Promise.all([ await Promise.all([
storePhotos(release.photos, { storePhotos(release.photos, {
targetId: releaseId, targetId: releaseId,
subpath, subpath,
}), }, identifier),
storePhotos([release.poster], { release.poster && storePhotos([release.poster], {
role: 'poster', role: 'poster',
targetId: releaseId, targetId: releaseId,
subpath, subpath,
}), }, identifier),
storePhotos(release.covers, {
role: 'cover',
targetId: releaseId,
subpath,
}, identifier),
storeTrailer(release.trailer, { storeTrailer(release.trailer, {
targetId: releaseId, targetId: releaseId,
subpath, subpath,
}), }, identifier),
]); ]);
} catch (error) { } catch (error) {
console.log(release.url, error); console.log(release.url, error);

View File

@ -208,13 +208,12 @@ function scrapeMovie(html, url, site) {
const { document } = new JSDOM(html).window; const { document } = new JSDOM(html).window;
const movie = { url, site }; const movie = { url, site };
console.log(url);
movie.entryId = document.querySelector('.dvd_details_overview .rating_box').dataset.id; movie.entryId = document.querySelector('.dvd_details_overview .rating_box').dataset.id;
movie.title = document.querySelector('.title_bar span').textContent; movie.title = document.querySelector('.title_bar span').textContent;
movie.covers = Array.from(document.querySelectorAll('#dvd-cover-flip > a'), el => el.href); movie.covers = Array.from(document.querySelectorAll('#dvd-cover-flip > a'), el => el.href);
movie.channel = document.querySelector('.update_date a').textContent; movie.channel = document.querySelector('.update_date a').textContent;
movie.date = new Date(); movie.date = new Date();
movie.releases = Array.from(document.querySelectorAll('.cell.dvd_info > a'), el => el.href);
return movie; return movie;
} }