Skip to content

Commit

Permalink
Update generating scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alistairjcbrown committed Nov 25, 2024
1 parent 9f28039 commit a16df0d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 3 additions & 1 deletion common/known-removable-phrases.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"London Breeze Festival:",
"1999 Season:",
"/Minus Colour",
"/ Minus Colour",
"20th Anniversary screening (3D)",
"Play for Today:",
"Philosophical Screens:",
Expand All @@ -95,5 +96,6 @@
"MADE IN PRAGUE:",
": Love in the Age of Anarchy",
": Reverie Cineclub: Fairytales from around the World",
": Reverie Cineclub"
": Reverie Cineclub",
"- PSYMPHONY"
]
5 changes: 4 additions & 1 deletion common/normalize-title.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ function normalizeTitle(title) {
const removablePrefixes = [
"Scared To Dance -",
"Hitchcock: The Gainsborough Days -",
"Bar Screening x Muse:",
"Kung Fu Cinema:",
"Preview Screening of",
];

removablePrefixes.forEach((phrase) => {
Expand All @@ -22,7 +25,7 @@ function normalizeTitle(title) {
title = hasPresented[1];
}

const hasSeparator = title.match(/^(.*?)\s+(?:\+|\-)\s*/);
const hasSeparator = title.match(/^(.*?)\s+(?:\+|\-|)\s*/);
if (hasSeparator) {
title = hasSeparator[1];
}
Expand Down
23 changes: 16 additions & 7 deletions scripts/generate-combined-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ const siteData = {
};

movie.performances = movie.performances.concat(
performances.map(({ time, notes, bookingUrl }) => ({
performances.map(({ time, notes, bookingUrl, screen }) => ({
showingId,
time,
notes: notes !== "" ? notes : undefined,
bookingUrl,
screen,
})),
);
}
Expand Down Expand Up @@ -230,14 +231,22 @@ const siteData = {
const container = { ...(matched || group[0]) };
group.forEach((movie) => {
if (movie.id === container.id) return;
// Add showing title in case it doesn't match container title
movie.showings = Object.keys(movie.showings).reduce(
(updatedShowings, showingId) => {
const showing = movie.showings[showingId];
if (showing.title || movie.title === container.title) {
return { ...updatedShowings, [showingId]: showing };
}
return {
...updatedShowings,
[showingId]: { ...showing, title: movie.title },
};
},
{},
);
// TODO: Merge genres? movie.genres
container.showings = { ...container.showings, ...movie.showings };
// Add performace title in case it doesn't match container title
// TODO: do this condionally
movie.performances = movie.performances.map((performance) => ({
...performance,
title: movie.title,
}));
container.performances = [
...container.performances,
...movie.performances,
Expand Down

0 comments on commit a16df0d

Please sign in to comment.