🚧 Allow movie image to be absent
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 8 Mar 2026 15:42:06 +0000 (16:42 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 8 Mar 2026 15:42:06 +0000 (16:42 +0100)
Some events are not even movies, and they don’t have posters.

src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/Movie.kt
src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieState.kt

index b1e7b88..ca17aae 100644 (file)
@@ -9,7 +9,7 @@ import java.util.stream.Collectors
  */
 data class Movie @JvmOverloads constructor(
        @JvmField @field:JsonProperty val name: String = "",
-       @JvmField @field:JsonProperty val imageUrl: String = "",
+       @JvmField @field:JsonProperty val imageUrl: String? = null,
        @JvmField @field:JsonProperty val description: String = "",
        @JvmField @field:JsonProperty val performances: Collection<Performance> = emptyList()
 )
index ae08995..c8704f5 100644 (file)
@@ -38,7 +38,7 @@ class MovieState(@JsonProperty val movies: Collection<Movie>, val newMovies: Col
                                        +"section.new-movies > .label { font-family: Impact, sans-serif; background-color: black; padding: 0.5ex; font-size: 200%; color: #ffffee; font-weight: bold; position: sticky; top: 0px; }"
                                        +"section.new-movies ul { padding: 0; margin: 0; }"
                                        +"section.new-movies li.movie { list-style: none; display: grid; margin: 1ex 1ex 1ex 0ex; grid-template-columns: 250px auto; }"
-                                       +"section.new-movies li.movie img { grid-area: 1/1/2/2; height: 353px; }"
+                                       +"section.new-movies li.movie .image { grid-area: 1/1/2/2; height: 353px; }"
                                        +"section.new-movies li.movie .text { color: white; text-shadow: 2px 2px black; font-weight: bold; font-size: 150%; display: flex; flex-direction: column; justify-content: end; grid-area: 1/1/2/2; height: 353px; }"
                                        +"section.new-movies li.movie .text .name { padding: 1ex; font-size: 120%; }"
                                        +"section.new-movies li.movie .description { padding: 1ex; }"
@@ -49,7 +49,7 @@ class MovieState(@JsonProperty val movies: Collection<Movie>, val newMovies: Col
                                        +"section.daily-programmes li .performances { border-top: 1ex; }"
                                        +"section.daily-programmes li.performance { display: inline-block; margin: 1ex 1ex 1ex 0ex; }"
                                        +"section.daily-programmes li.performance a { text-decoration: none; color: white; text-shadow: 2px 2px black; font-weight: bold; font-size: 150%; display: grid; width: 250px; height: 353px; grid-template-rows: 0fr 0fr 1fr 0fr; grid-template-columns: 250px; }"
-                                       +"section.daily-programmes li.performance a img { grid-area: 1/1/5/1; z-index: -1; width: 100%; height: 100%; }"
+                                       +"section.daily-programmes li.performance a .image { grid-area: 1/1/5/1; z-index: -1; width: 100%; height: 100%; }"
                                        +"section.daily-programmes li.performance a .time { grid-area: 1/1/2/1; padding: 1ex 1ex 0ex 1ex; text-align: right; }"
                                        +"section.daily-programmes li.performance a .type { grid-area: 2/1/3/1; padding: 0ex 1ex 1ex 1ex; text-align: right; }"
                                        +"section.daily-programmes li.performance a .name { grid-area: 4/1/5/1; padding: 1ex; font-size: 120%; }"
@@ -97,7 +97,7 @@ class MovieState(@JsonProperty val movies: Collection<Movie>, val newMovies: Col
                                                                        .forEach { (movie, performance) ->
                                                                                li("performance") {
                                                                                        a(href = performance.link) {
-                                                                                               img(src = movie.imageUrl)
+                                                                                               movie.imageUrl?.let { img(classes = "image", src = it) } ?: div(classes = "image")
                                                                                                div("time") {
                                                                                                        +("%tH:%<tM".format(performance.time))
                                                                                                }