Skip to content

Commit

Permalink
Fix bug with kinoheld special screenings
Browse files Browse the repository at this point in the history
The movie was null and was defaulting to a placeholder movie w/ an empty
title. If there is no movie defined, try to grab the title from the
show, which does exist.
  • Loading branch information
diurnalist committed Nov 1, 2020
1 parent 21b81f4 commit 7567d87
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/lib/scraper/kinoheld.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,25 @@ export default (location, timezone, permalink) => (callback) => {

Object.keys(shows).forEach((key) => {
const show = shows[key];
const movie = Object.values(movies).find(({ id }) => show.movieId === id);

if (!movie) {
log(`could not find entry for movie with id=${show.movieId}`);
return; // Skip
let title = show.name || '';

if (show.movieId) {
const movie = Object.values(movies).find(({ id }) => show.movieId === id);
if (! movie) {
log(`could not find entry for movie with id=${show.movieId}`);
return; // Skip
}
if (movie.name) {
title = movie.name;
}
}

const deepLink = show.url && url.resolve(HOST, show.url);
const language = show.flags
.filter(({ category }) => category === 'language')
.map(({ name }) => name)[0] || null;
const showtime = parse(`${show.date}T${show.time}`, timezone);
const title = movie.name.replace(/\((ov|ome?u)\)/i, '').trim();
title = title.replace(/\((ov|ome?u)\)/i, '').trim();

showtimes.push({
deepLink,
Expand Down

0 comments on commit 7567d87

Please sign in to comment.