From 4b650a9b2286e0b05a74fabc36bc2337c89ebd71 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 3 Mar 2024 11:40:48 +0100 Subject: [PATCH] =?utf8?q?=E2=9C=A8=20Show=20movie=20release=20type=20in?= =?utf8?q?=20generated=20HTML?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../filters/webpages/savoy/Performance.java | 16 ++- .../filters/webpages/savoy/MovieExtractor.kt | 2 +- .../rhynodge/filters/webpages/savoy/MovieState.kt | 8 +- .../filters/webpages/savoy/MovieExtractorTest.java | 135 +++++++++++---------- .../filters/webpages/savoy/MovieStateTest.kt | 30 ++++- .../filters/webpages/savoy/SavoyMergerTest.kt | 24 ++-- 6 files changed, 128 insertions(+), 87 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java b/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java index c50dd31..dd4c165 100644 --- a/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java +++ b/src/main/java/net/pterodactylus/rhynodge/filters/webpages/savoy/Performance.java @@ -14,14 +14,18 @@ public class Performance { private final LocalDateTime time; @JsonProperty + private final String type; + + @JsonProperty private final String link; public Performance() { - this(null, null); + this(null, null, null); } - public Performance(LocalDateTime time, String link) { + public Performance(LocalDateTime time, String type, String link) { this.time = time; + this.type = type; this.link = link; } @@ -29,13 +33,17 @@ public class Performance { return time; } + public String getType() { + return type; + } + public String getLink() { return link; } @Override public int hashCode() { - return Objects.hash(time, link); + return Objects.hash(time, type, link); } @Override @@ -43,7 +51,7 @@ public class Performance { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Performance that = (Performance) o; - return Objects.equals(time, that.time) && Objects.equals(link, that.link); + return Objects.equals(time, that.time) && Objects.equals(type, that.type) && Objects.equals(link, that.link); } } diff --git a/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt b/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt index 8bd0812..a87d639 100644 --- a/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt +++ b/src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieExtractor.kt @@ -31,7 +31,7 @@ class MovieExtractor { val begin = LocalDateTime.parse(performance.get("begin").asText(), dateFormat) val slug = performance.get("slug").asText() val link = "https://savoy.premiumkino.de/vorstellung/${slug}/${String.format("%tY%, val newMovies: Col +"section.daily-programmes li.performance { width: 250px; height: 353px; display: inline-block; margin: 1ex 1ex 1ex 0ex; position: relative; }" +"section.daily-programmes li.performance a { width: 100%; height: 100%; display: block; text-decoration: none; }" +"section.daily-programmes li.performance a img { width: 100%; height: 100%; display: block; position: absolute; z-index: -1; }" - +"section.daily-programmes li.performance a .text { color: white; text-shadow: 2px 2px black; font-weight: bold; font-size: 150%; display: flex; flex-direction: column; justify-content: space-between; width: 100%; height: 100%; }" + +"section.daily-programmes li.performance a .text { color: white; text-shadow: 2px 2px black; font-weight: bold; font-size: 150%; width: 100%; height: 100%; }" +"section.daily-programmes li.performance a .text .time { padding: 1ex; text-align: right; }" - +"section.daily-programmes li.performance a .text .name { padding: 1ex; font-size: 120%; }" + +"section.daily-programmes li.performance a .text .type { padding: 0ex 1ex 1ex 1ex; text-align: right; }" + +"section.daily-programmes li.performance a .text .name { padding: 1ex; font-size: 120%; bottom: 0px; position: absolute; }" } } body { @@ -96,6 +97,9 @@ class MovieState(@JsonProperty val movies: Collection, val newMovies: Col div("time") { +("%tH:%(of(2024, 2, 9, 16, 15), "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240209/1615/HkKdhlHMvtfSMy1fqYYtYuVdgGIKtnT7i7ddY5jzRfY~"), - new Pair<>(of(2024, 2, 10, 22, 15), "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240210/2215/znWqm8FQUNSbrODY_A0jw8Au2nW6uSqbFE7Co8UgQv0~"), - new Pair<>(of(2024, 2, 11, 20, 15), "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240211/2015/I642oTHBKpy7sz2RULHIQK6cykSCPi57_c0TApiKbUk~"), - new Pair<>(of(2024, 2, 12, 17, 15), "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240212/1715/2lEiqVP1hueXZhWwy9FSUfRgFKf8iTCKRMdJOTfBf8A~"), - new Pair<>(of(2024, 2, 13, 20, 30), "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240213/2030/M0mIWdKm5gZkan5na6zOVFBzsHWAHhqod8RCmG2Fr0Y~"), - new Pair<>(of(2024, 2, 14, 14, 30), "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240214/1430/VZhgxh4PZutWWlLPEAe9dfOUJkB3sLnXzWoduICJYTk~") + performance(of(2024, 2, 9, 16, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240209/1615/HkKdhlHMvtfSMy1fqYYtYuVdgGIKtnT7i7ddY5jzRfY~"), + performance(of(2024, 2, 10, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240210/2215/znWqm8FQUNSbrODY_A0jw8Au2nW6uSqbFE7Co8UgQv0~"), + performance(of(2024, 2, 11, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240211/2015/I642oTHBKpy7sz2RULHIQK6cykSCPi57_c0TApiKbUk~"), + performance(of(2024, 2, 12, 17, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240212/1715/2lEiqVP1hueXZhWwy9FSUfRgFKf8iTCKRMdJOTfBf8A~"), + performance(of(2024, 2, 13, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240213/2030/M0mIWdKm5gZkan5na6zOVFBzsHWAHhqod8RCmG2Fr0Y~"), + performance(of(2024, 2, 14, 14, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/all-of-us-strangers/20240214/1430/VZhgxh4PZutWWlLPEAe9dfOUJkB3sLnXzWoduICJYTk~") ), movie("Dune", "https://cdn.premiumkino.de/movie/3261/bcc70cb1cc4559731b6fd547d0f5cee1.jpg", - new Pair<>(of(2024, 2, 9, 19, 0), "https://savoy.premiumkino.de/vorstellung/dune/20240209/1900/o9jDuan4yyxaW7-Jg3hCJpiAM4CLZei8J2IX-O5-hA0~"), - new Pair<>(of(2024, 2, 10, 15, 30), "https://savoy.premiumkino.de/vorstellung/dune/20240210/1530/jXbZnYD8R5djVnj3Ojjcsc9qdSJ0JBMVhn7PeP88HyY~"), - new Pair<>(of(2024, 2, 11, 13, 30), "https://savoy.premiumkino.de/vorstellung/dune/20240211/1330/aJmlM8wOaGl_jtuWDvWG9TF7RR1zRpNrSZeArCBhn90~"), - new Pair<>(of(2024, 2, 12, 20, 0), "https://savoy.premiumkino.de/vorstellung/dune/20240212/2000/2KLOCZy5zU060zKj-4zafxm3oalEyT4tNi2Fxnw5D7E~"), - new Pair<>(of(2024, 2, 13, 17, 0), "https://savoy.premiumkino.de/vorstellung/dune/20240213/1700/QCphOtH-WrZ2tRbENwaxXPskrN2gH3I8dHR0Y5L3l0Y~") + performance(of(2024, 2, 9, 19, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240209/1900/o9jDuan4yyxaW7-Jg3hCJpiAM4CLZei8J2IX-O5-hA0~"), + performance(of(2024, 2, 10, 15, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240210/1530/jXbZnYD8R5djVnj3Ojjcsc9qdSJ0JBMVhn7PeP88HyY~"), + performance(of(2024, 2, 11, 13, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240211/1330/aJmlM8wOaGl_jtuWDvWG9TF7RR1zRpNrSZeArCBhn90~"), + performance(of(2024, 2, 12, 20, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240212/2000/2KLOCZy5zU060zKj-4zafxm3oalEyT4tNi2Fxnw5D7E~"), + performance(of(2024, 2, 13, 17, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune/20240213/1700/QCphOtH-WrZ2tRbENwaxXPskrN2gH3I8dHR0Y5L3l0Y~") ), movie("SAVOY Sneak-Preview", "https://cdn.premiumkino.de/movie/5617/33dc4c74b4cca5cf4585b4cadfc38ec4.png", - new Pair<>(of(2024, 2, 9, 22, 30), "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240209/2230/GtYBcOR_Jy7a8xDxwwPHI0wfY_v_Ep2P6rV0w4wJ7SM~"), - new Pair<>(of(2024, 2, 16, 22, 0), "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240216/2200/ZRC7iir9Hu8nIpH1PsiA_UDvckcj7yGqgMEYXHAs9Qw~") + performance(of(2024, 2, 9, 22, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240209/2230/GtYBcOR_Jy7a8xDxwwPHI0wfY_v_Ep2P6rV0w4wJ7SM~"), + performance(of(2024, 2, 16, 22, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/sneak-preview/20240216/2200/ZRC7iir9Hu8nIpH1PsiA_UDvckcj7yGqgMEYXHAs9Qw~") ), movie("Der Junge und der Reiher", "https://cdn.premiumkino.de/movie/4013/b129f329bc07315ccd9591fd2cde19b4.jpg", - new Pair<>(of(2024, 2, 10, 12, 30), "https://savoy.premiumkino.de/vorstellung/der-junge-und-der-reiher/20240210/1230/F0atZERI4Gssj3LGC-2fQlLF3rM9Uk8IbpOzHaXyx7w~") + performance(of(2024, 2, 10, 12, 30), "2D OmeU", "https://savoy.premiumkino.de/vorstellung/der-junge-und-der-reiher/20240210/1230/F0atZERI4Gssj3LGC-2fQlLF3rM9Uk8IbpOzHaXyx7w~") ), movie("Poor Things", "https://cdn.premiumkino.de/movie/1066/aba09af737677ff6a15676ae588098b1.jpg", - new Pair<>(of(2024, 2, 10, 19, 0), "https://savoy.premiumkino.de/vorstellung/poor-things/20240210/1900/SqolavKZAlBMZH_JAN-OqdZqowBv-aRqhPGHvPTphao~"), - new Pair<>(of(2024, 2, 11, 17, 0), "https://savoy.premiumkino.de/vorstellung/poor-things/20240211/1700/UrS33k-jY7_ZAsm4B7wydy0SBfdVjdd73On68HtIy9E~"), - new Pair<>(of(2024, 2, 13, 13, 45), "https://savoy.premiumkino.de/vorstellung/poor-things/20240213/1345/gma7KCzuaJQCSoBm8NMJb3ATjtMISm4M9IiwiVNpXpw~"), - new Pair<>(of(2024, 2, 14, 17, 15), "https://savoy.premiumkino.de/vorstellung/poor-things/20240214/1715/cBjQj4qRrJaSX3m_acvfxNL1Tclg0Rrt_X63Md0rkEw~") + performance(of(2024, 2, 10, 19, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240210/1900/SqolavKZAlBMZH_JAN-OqdZqowBv-aRqhPGHvPTphao~"), + performance(of(2024, 2, 11, 17, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240211/1700/UrS33k-jY7_ZAsm4B7wydy0SBfdVjdd73On68HtIy9E~"), + performance(of(2024, 2, 13, 13, 45), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240213/1345/gma7KCzuaJQCSoBm8NMJb3ATjtMISm4M9IiwiVNpXpw~"), + performance(of(2024, 2, 14, 17, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/poor-things/20240214/1715/cBjQj4qRrJaSX3m_acvfxNL1Tclg0Rrt_X63Md0rkEw~") ), movie("Vergiss mein nicht- Eternal Sunshine of the Spotless Mind", "https://cdn.premiumkino.de/movie/2641/963c11bfaccb7c66da0b6b25ea8ed299.jpg", - new Pair<>(of(2024, 2, 14, 20, 30), "https://savoy.premiumkino.de/vorstellung/vergiss-mein-nicht-eternal-sunshine-of-the-spotless-mind/20240214/2030/QqoCtd4ls09AD04rGSNh8qPkf02rcRzp2wFfF2BoobE~") + performance(of(2024, 2, 14, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/vergiss-mein-nicht-eternal-sunshine-of-the-spotless-mind/20240214/2030/QqoCtd4ls09AD04rGSNh8qPkf02rcRzp2wFfF2BoobE~") ), movie("Bob Marley: One Love", "https://cdn.premiumkino.de/movie/1243/772641b8454ce4ea28c5eb56ec74365f.jpg", - new Pair<>(of(2024, 2, 15, 20, 15), "https://savoy.premiumkino.de/vorstellung/bob-marley-one-love/20240215/2015/q4dxyPDNVvZDEeIuh1r9Y4OJ7UK36CKSr2d7p3h9LMs~") + performance(of(2024, 2, 15, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/bob-marley-one-love/20240215/2015/q4dxyPDNVvZDEeIuh1r9Y4OJ7UK36CKSr2d7p3h9LMs~") ), movie("The Hateful 8", "https://cdn.premiumkino.de/movie/6651/164fd22df165c914f118f85ff0bd34aa.jpg", - new Pair<>(of(2024, 2, 18, 19, 45), "https://savoy.premiumkino.de/vorstellung/the-hateful-8/20240218/1945/dusKDbTYgF79OipGmQO0Q4P5K02rclkjIV9At8qKfOA~") + performance(of(2024, 2, 18, 19, 45), "70mm OV", "https://savoy.premiumkino.de/vorstellung/the-hateful-8/20240218/1945/dusKDbTYgF79OipGmQO0Q4P5K02rclkjIV9At8qKfOA~") ), movie("Prinzessin Mononoke", "https://cdn.premiumkino.de/movie/6085/062bbdbbda9f86b7e066486412532369.jpg", - new Pair<>(of(2024, 2, 19, 20, 15), "https://savoy.premiumkino.de/vorstellung/prinzessin-mononoke/20240219/2015/LmbLtOrTZxBgPlBMzoRZ4_C-PfO64GeXNIKr5KGs-2M~"), - new Pair<>(of(2024, 2, 22, 20, 15), "https://savoy.premiumkino.de/vorstellung/prinzessin-mononoke/20240222/2015/mvbGK2fA5AgPbADOzm7sqFYYzm2qdqqdwqdLu4rMPrg~") + performance(of(2024, 2, 19, 20, 15), "2D OmeU", "https://savoy.premiumkino.de/vorstellung/prinzessin-mononoke/20240219/2015/LmbLtOrTZxBgPlBMzoRZ4_C-PfO64GeXNIKr5KGs-2M~"), + performance(of(2024, 2, 22, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/prinzessin-mononoke/20240222/2015/mvbGK2fA5AgPbADOzm7sqFYYzm2qdqqdwqdLu4rMPrg~") ), movie("Das fünfte Element (Best of Cinema)", "https://cdn.premiumkino.de/movie/2861/69770d12a16f13df00b70cb830b9d75b.jpg", - new Pair<>(of(2024, 2, 20, 20, 30), "https://savoy.premiumkino.de/vorstellung/das-fuenfte-element-best-of-cinema/20240220/2030/QcJZ5Yh8P2j_HKLSP8cjcXsqkbdqYdYGTexCF3RF2R4~") + performance(of(2024, 2, 20, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/das-fuenfte-element-best-of-cinema/20240220/2030/QcJZ5Yh8P2j_HKLSP8cjcXsqkbdqYdYGTexCF3RF2R4~") ), movie("Heaven Can Wait - wir leben jetzt", "https://cdn.premiumkino.de/movie/3191/b9698912f3fdec6bd72fe66be9cab6f0.jpg", - new Pair<>(of(2024, 2, 21, 11, 0), "https://savoy.premiumkino.de/vorstellung/heaven-can-wait-wir-leben-jetzt/20240221/1100/GW7pwEYabwN3-e8uTGmSPTfdbyXoKe4la-B2L1SI8XI~") + performance(of(2024, 2, 21, 11, 0), "2D", "https://savoy.premiumkino.de/vorstellung/heaven-can-wait-wir-leben-jetzt/20240221/1100/GW7pwEYabwN3-e8uTGmSPTfdbyXoKe4la-B2L1SI8XI~") ), movie("Demon Slayer: Kimetsu no yaiba - Zum Training der Säulen", "https://cdn.premiumkino.de/movie/3478/96e87d7ec36c9c2b2d4ff2cc933c9401.jpg", - new Pair<>(of(2024, 2, 27, 20, 30), "https://savoy.premiumkino.de/vorstellung/demon-slayer-kimetsu-no-yaiba-zum-training-der-saeulen/20240227/2030/UsAsz9NQPZGfdyLelrAHZ50MXeoElhNIPcgg3unBR0o~") + performance(of(2024, 2, 27, 20, 30), "2D OmeU", "https://savoy.premiumkino.de/vorstellung/demon-slayer-kimetsu-no-yaiba-zum-training-der-saeulen/20240227/2030/UsAsz9NQPZGfdyLelrAHZ50MXeoElhNIPcgg3unBR0o~") ), movie("Double Feature DUNE 1&2", "https://cdn.premiumkino.de/movie/7300/14d1b21dee51a82a7b096ca282bf01c8.png", - new Pair<>(of(2024, 2, 28, 17, 30), "https://savoy.premiumkino.de/vorstellung/double-feature-dune-1und2/20240228/1730/Ni6Yo0fA4k7gEZiJB8Cnq33Axjnw85JBG2lBIVRwYok~"), - new Pair<>(of(2024, 3, 3, 10, 0), "https://savoy.premiumkino.de/vorstellung/double-feature-dune-1und2/20240303/1000/AXcH4nnYJB9Ar0aR5zFl3Bfa238POna3UVY66_nHL6c~") + performance(of(2024, 2, 28, 17, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/double-feature-dune-1und2/20240228/1730/Ni6Yo0fA4k7gEZiJB8Cnq33Axjnw85JBG2lBIVRwYok~"), + performance(of(2024, 3, 3, 10, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/double-feature-dune-1und2/20240303/1000/AXcH4nnYJB9Ar0aR5zFl3Bfa238POna3UVY66_nHL6c~") ), movie("Dune: Part Two", "https://cdn.premiumkino.de/movie/4669/f0a036d58d75302739ea5680ab8405bc.jpg", - new Pair<>(of(2024, 2, 29, 12, 30), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/1230/Osq78ODtBKchFFx1HgAmEPAAIWLC6JgxWqC638UaRws~"), - new Pair<>(of(2024, 2, 29, 16, 15), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/1615/hJ3kXaFB-LjfZu2pYBVx0R_2UoqOJANwWX_AS4KW6FI~"), - new Pair<>(of(2024, 2, 29, 20, 0), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/2000/EwA7Z5KlKNnIr0e4o_tXGpYp6xN90juBl92wcTVIZ-Q~"), - new Pair<>(of(2024, 3, 1, 13, 45), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/1345/-kxmskcNJYhWCr9z5MfK0p2w2qlu3CDu8rVtDLmxSQA~"), - new Pair<>(of(2024, 3, 1, 17, 30), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/1730/yXQQSsMug0nRQGN1BNpBXEA3Udf_asggPHwk4a4zdBE~"), - new Pair<>(of(2024, 3, 1, 21, 15), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/2115/FN7huOUR4eLA-2EKxi9lTykJUFQNYc4LTHRHtyDlAgo~"), - new Pair<>(of(2024, 3, 2, 10, 0), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1000/84ntwEOFY6aqexIEd9tXESW6qrl9aXk-x2l-LsHWvfk~"), - new Pair<>(of(2024, 3, 2, 13, 45), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1345/9lxXFXQU6FHmyv1WpKX5ETpd24daZT16hNvXUJEUwik~"), - new Pair<>(of(2024, 3, 2, 17, 30), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1730/ynmy2dsbgYygz2hPUS_vx-9YL13m2KZ0-9tw37XuBMQ~"), - new Pair<>(of(2024, 3, 2, 21, 15), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/2115/rH8i8BAFaaDjfNJBbZjj_7CV2dzOWcEOzyL618KYQVo~"), - new Pair<>(of(2024, 3, 3, 16, 30), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240303/1630/fU4VOzrp34B48KdsB1vpo2pi18sWSo2Tkknk03sO4HY~"), - new Pair<>(of(2024, 3, 3, 20, 15), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240303/2015/b1yBhvNosqm0nbWju1aCfb7LRBhRnMo_Y_h0VLZwmr0~"), - new Pair<>(of(2024, 3, 4, 12, 30), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/1230/DcGmb0KshRY0qv55Tuo4ydiJswd1H9wonrYGF1zGqQ0~"), - new Pair<>(of(2024, 3, 4, 16, 15), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/1615/BEd4wzePEH_Sxxuum4cXpsoOubN8fA6oecrWpwGJpcc~"), - new Pair<>(of(2024, 3, 4, 20, 0), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/2000/7Qldfc-0lDNALUw_lzuzM3KfarQWQAUi91qz2cMrNDk~"), - new Pair<>(of(2024, 3, 5, 12, 30), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/1230/QiP6Vvb9htMnFyTSUZRte1b_Ykw_n_yzaGpErBLFjOE~"), - new Pair<>(of(2024, 3, 5, 16, 15), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/1615/eY9ufKz1UM777apocN37PLvlsWwSJXc0xu7LMHecCbk~"), - new Pair<>(of(2024, 3, 5, 20, 0), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/2000/2gqVyU2_3NXv_fZiiAxV8Utom82nPW52kzVxzUDrMkI~"), - new Pair<>(of(2024, 3, 6, 16, 0), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240306/1600/Y8x2dIEq1QbEpZf7Td-6-3xqg-d4iDQU9p1fIjxJB0M~"), - new Pair<>(of(2024, 3, 6, 19, 45), "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240306/1945/mSiOQk7DuM02IdmaVIvsv5nechCpRkWZwsK37hoXTyg~") + performance(of(2024, 2, 29, 12, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/1230/Osq78ODtBKchFFx1HgAmEPAAIWLC6JgxWqC638UaRws~"), + performance(of(2024, 2, 29, 16, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/1615/hJ3kXaFB-LjfZu2pYBVx0R_2UoqOJANwWX_AS4KW6FI~"), + performance(of(2024, 2, 29, 20, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240229/2000/EwA7Z5KlKNnIr0e4o_tXGpYp6xN90juBl92wcTVIZ-Q~"), + performance(of(2024, 3, 1, 13, 45), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/1345/-kxmskcNJYhWCr9z5MfK0p2w2qlu3CDu8rVtDLmxSQA~"), + performance(of(2024, 3, 1, 17, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/1730/yXQQSsMug0nRQGN1BNpBXEA3Udf_asggPHwk4a4zdBE~"), + performance(of(2024, 3, 1, 21, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240301/2115/FN7huOUR4eLA-2EKxi9lTykJUFQNYc4LTHRHtyDlAgo~"), + performance(of(2024, 3, 2, 10, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1000/84ntwEOFY6aqexIEd9tXESW6qrl9aXk-x2l-LsHWvfk~"), + performance(of(2024, 3, 2, 13, 45), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1345/9lxXFXQU6FHmyv1WpKX5ETpd24daZT16hNvXUJEUwik~"), + performance(of(2024, 3, 2, 17, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/1730/ynmy2dsbgYygz2hPUS_vx-9YL13m2KZ0-9tw37XuBMQ~"), + performance(of(2024, 3, 2, 21, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240302/2115/rH8i8BAFaaDjfNJBbZjj_7CV2dzOWcEOzyL618KYQVo~"), + performance(of(2024, 3, 3, 16, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240303/1630/fU4VOzrp34B48KdsB1vpo2pi18sWSo2Tkknk03sO4HY~"), + performance(of(2024, 3, 3, 20, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240303/2015/b1yBhvNosqm0nbWju1aCfb7LRBhRnMo_Y_h0VLZwmr0~"), + performance(of(2024, 3, 4, 12, 30), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/1230/DcGmb0KshRY0qv55Tuo4ydiJswd1H9wonrYGF1zGqQ0~"), + performance(of(2024, 3, 4, 16, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/1615/BEd4wzePEH_Sxxuum4cXpsoOubN8fA6oecrWpwGJpcc~"), + performance(of(2024, 3, 4, 20, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240304/2000/7Qldfc-0lDNALUw_lzuzM3KfarQWQAUi91qz2cMrNDk~"), + performance(of(2024, 3, 5, 12, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/1230/QiP6Vvb9htMnFyTSUZRte1b_Ykw_n_yzaGpErBLFjOE~"), + performance(of(2024, 3, 5, 16, 15), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/1615/eY9ufKz1UM777apocN37PLvlsWwSJXc0xu7LMHecCbk~"), + performance(of(2024, 3, 5, 20, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240305/2000/2gqVyU2_3NXv_fZiiAxV8Utom82nPW52kzVxzUDrMkI~"), + performance(of(2024, 3, 6, 16, 0), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240306/1600/Y8x2dIEq1QbEpZf7Td-6-3xqg-d4iDQU9p1fIjxJB0M~"), + performance(of(2024, 3, 6, 19, 45), "70mm OV", "https://savoy.premiumkino.de/vorstellung/dune-part-two/20240306/1945/mSiOQk7DuM02IdmaVIvsv5nechCpRkWZwsK37hoXTyg~") ), movie("791 KM", "https://cdn.premiumkino.de/movie/2753/9585e7bd814dd2bef5d45427df2f2e92.jpg", - new Pair<>(of(2024, 3, 6, 11, 0), "https://savoy.premiumkino.de/vorstellung/791-km/20240306/1100/Mcvtz3tawhaIuyCtLtBkHwt6EI8b7oGXwh5OV4YWwNQ~") + performance(of(2024, 3, 6, 11, 0), "2D", "https://savoy.premiumkino.de/vorstellung/791-km/20240306/1100/Mcvtz3tawhaIuyCtLtBkHwt6EI8b7oGXwh5OV4YWwNQ~") ), movie("Following", "https://cdn.premiumkino.de/movie/3972/b2e687cfb6dffeb4f64acde41e7d286a.jpg", - new Pair<>(of(2024, 3, 9, 12, 0), "https://savoy.premiumkino.de/vorstellung/following/20240309/1200/-Aetrz3gC8l4rgVfGc98XXU7B87mTA4RCbWCgZuXHzc~") + performance(of(2024, 3, 9, 12, 0), "2D OV", "https://savoy.premiumkino.de/vorstellung/following/20240309/1200/-Aetrz3gC8l4rgVfGc98XXU7B87mTA4RCbWCgZuXHzc~") ), movie("Donnie Darko (Best of Cinema)", "https://cdn.premiumkino.de/movie/5245/05adfa102a8fb61f47727224369af706.jpg", - new Pair<>(of(2024, 3, 16, 22, 15), "https://savoy.premiumkino.de/vorstellung/donnie-darko-best-of-cinema/20240316/2215/ZIBOwCyKuZ7A6OyYZWQ1AqF9O487dY_LAMmURYrGqUs~") + performance(of(2024, 3, 16, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/donnie-darko-best-of-cinema/20240316/2215/ZIBOwCyKuZ7A6OyYZWQ1AqF9O487dY_LAMmURYrGqUs~") ), movie("NT: Vanya", "https://cdn.premiumkino.de/movie/7449/cb5f27438bbffa247ca4081690f0ded9.jpg", - new Pair<>(of(2024, 3, 18, 20, 30), "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240318/2030/X9L2eAn_XElOtZRg7u4eiQ6kUCqcuJhrwQ5T76OAt2s~"), - new Pair<>(of(2024, 3, 23, 22, 15), "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240323/2215/xXgXAH_I7xX3GsQ4eA4rZsOOrJqAtK0hCCXexFMj0Fk~"), - new Pair<>(of(2024, 4, 8, 20, 30), "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240408/2030/PDQ-R_ltFWo8QAn-BbloxETvgegcTyaQyCZrG_MwQfo~") + performance(of(2024, 3, 18, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240318/2030/X9L2eAn_XElOtZRg7u4eiQ6kUCqcuJhrwQ5T76OAt2s~"), + performance(of(2024, 3, 23, 22, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240323/2215/xXgXAH_I7xX3GsQ4eA4rZsOOrJqAtK0hCCXexFMj0Fk~"), + performance(of(2024, 4, 8, 20, 30), "2D OV", "https://savoy.premiumkino.de/vorstellung/nt-vanya/20240408/2030/PDQ-R_ltFWo8QAn-BbloxETvgegcTyaQyCZrG_MwQfo~") ), movie("No Country For Old Men", "https://cdn.premiumkino.de/movie/1290/dcab4000b5b95ebcc4108906d9b4e0a1.jpg", - new Pair<>(of(2024, 3, 26, 20, 15), "https://savoy.premiumkino.de/vorstellung/no-country-for-old-men/20240326/2015/jtZD6DfmChngY1mDGWlaaV8kZdUPL_QT2Fh-t0clBpU~") + performance(of(2024, 3, 26, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/no-country-for-old-men/20240326/2015/jtZD6DfmChngY1mDGWlaaV8kZdUPL_QT2Fh-t0clBpU~") ), movie("Lisa Achatzi: Vom Traum zum Trauma - und zurück", "https://cdn.premiumkino.de/movie/7729/373dec2c25c06034c5d95e2d205a603c.jpg", - new Pair<>(of(2024, 4, 14, 12, 0), "https://savoy.premiumkino.de/vorstellung/lisa-achatzi-vom-traum-zum-trauma-und-zurueck/20240414/1200/MOLgymd988D7m8ZOvhM75aDc5suv3VO9aHobbLsaOgQ~") + performance(of(2024, 4, 14, 12, 0), "2D", "https://savoy.premiumkino.de/vorstellung/lisa-achatzi-vom-traum-zum-trauma-und-zurueck/20240414/1200/MOLgymd988D7m8ZOvhM75aDc5suv3VO9aHobbLsaOgQ~") ), movie("Movie Quiz: Test Your Movie Knowledge", "https://cdn.premiumkino.de/movie/1702/ebfecdd4c3cacb6435ba2bffb84a6902.jpg", - new Pair<>(of(2024, 4, 15, 20, 15), "https://savoy.premiumkino.de/vorstellung/movie-quiz-test-your-movie-knowledge/20240415/2015/DMAaL86yGoobZhPTDdU2ksO9RUTFoPCiQKGOY7TO6tg~") + performance(of(2024, 4, 15, 20, 15), "2D OV", "https://savoy.premiumkino.de/vorstellung/movie-quiz-test-your-movie-knowledge/20240415/2015/DMAaL86yGoobZhPTDdU2ksO9RUTFoPCiQKGOY7TO6tg~") ) )); } - private Matcher movie(String name, String imageUrl, Pair... presentationTimesAndLinks) { + @SafeVarargs + private Matcher movie(String name, String imageUrl, Triple... presentationTimesTypesAndLinks) { return new TypeSafeDiagnosingMatcher() { @Override protected boolean matchesSafely(Movie movie, Description mismatchDescription) { @@ -160,20 +162,20 @@ public class MovieExtractorTest { return false; } List performances = new ArrayList<>(movie.getPerformances()); - if (performances.size() != presentationTimesAndLinks.length) { + if (performances.size() != presentationTimesTypesAndLinks.length) { mismatchDescription.appendText("has ").appendValue(performances.size()).appendText(" presentations"); return false; } - for (Pair presentationTimeAndLink : presentationTimesAndLinks) { + for (Triple presentationTimeTypeAndLink : presentationTimesTypesAndLinks) { Optional foundLink = empty(); for (Performance performance : performances) { - if (performance.getTime().equals(presentationTimeAndLink.getFirst()) && performance.getLink().equals(presentationTimeAndLink.getSecond())) { + if (performance.getTime().equals(presentationTimeTypeAndLink.getFirst()) && performance.getType().equals(presentationTimeTypeAndLink.getSecond()) && performance.getLink().equals(presentationTimeTypeAndLink.getThird())) { foundLink = Optional.of(performance); break; } } if (!foundLink.isPresent()) { - mismatchDescription.appendValue("has no presentation at ").appendValue(presentationTimeAndLink.getFirst()); + mismatchDescription.appendValue("has no presentation at ").appendValue(presentationTimeTypeAndLink.getFirst()); return false; } performances.remove(foundLink.get()); @@ -188,9 +190,14 @@ public class MovieExtractorTest { @Override public void describeTo(Description description) { description.appendText("movie with name ").appendValue(name); - description.appendText(" and ").appendValue(presentationTimesAndLinks.length).appendText(" presentations"); + description.appendText(" and ").appendValue(presentationTimesTypesAndLinks.length).appendText(" presentations"); } }; } + @Nonnull + private static Triple performance(@Nonnull LocalDateTime dateTime, @Nonnull String type, @Nonnull String link) { + return new Triple<>(dateTime, type, link); + } + } diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt index 54a6dde..857bd03 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/MovieStateTest.kt @@ -19,9 +19,9 @@ class MovieStateTest { fun `summary contains date of earliest movie`() { val movieState = MovieState( setOf( - Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 12, 18, 45), "")) }, - Movie("2", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 3, 12, 15, 30), "")) }, - Movie("3", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 11, 21, 15), "")) } + Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 12, 18, 45), "", "")) }, + Movie("2", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 3, 12, 15, 30), "", "")) }, + Movie("3", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 11, 21, 15), "", "")) } ), emptySet() ) assertThat(movieState.output(Reaction("", null, null, null)).summary(), containsString("2024-02-11")) @@ -108,6 +108,24 @@ class MovieStateTest { ) } + @Test + fun `html output contains the correct release type for movies`() { + val movieState = MovieState( + setOf( + movie("Movie 1", "https://cdn.premiumkino.de/movie/3047/81c49774d7828a898ae1d525ffd135af_w300.jpg", "20240212-1845" to "2D OV", "20240213-1330" to "2D", "20240214-1815" to "2D OmeU"), + ), setOf() + ) + val output = movieState.output(Reaction("", null, null, null)) + val html = output.text("text/html") + val document = Jsoup.parse(html) + assertThat( + document.select("section.daily-programmes li.performance") + .map { performance -> listOf(".name", ".time", ".type").map { performance.select(it).text() }.joinToString(" - ")}, contains( + "Movie 1 - 18:45 - 2D OV", "Movie 1 - 13:30 - 2D", "Movie 1 - 18:15 - 2D OmeU" + ) + ) + } + } private fun dateTime(dateTimeString: String) = LocalDateTime.of( @@ -119,5 +137,9 @@ private fun dateTime(dateTimeString: String) = LocalDateTime.of( ) private fun movie(name: String, imageUrl: String, vararg times: String) = Movie(name, imageUrl).apply { - times.map(::dateTime).map { Performance(it, "https://link/$it") }.forEach(this::addPerformance) + times.map(::dateTime).map { Performance(it, "", "https://link/$it") }.forEach(this::addPerformance) +} + +private fun movie(name: String, imageUrl: String, vararg timesAndTypes: Pair) = Movie(name, imageUrl).apply { + timesAndTypes.map { Performance(it.first.let(::dateTime), it.second, "https://link/${it.first}") }.forEach(this::addPerformance) } diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt index d81c86f..4afe2af 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/filters/webpages/savoy/SavoyMergerTest.kt @@ -52,24 +52,24 @@ class SavoyMergerTest { @Test fun `movies with different performances are still considered the same movie`() { - val oldState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "")) })) - val newState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "")) })) + val oldState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "", "")) })) + val newState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "", "")) })) val mergedState = merger.mergeStates(oldState, newState) as MovieState assertThat(mergedState.newMovies, empty()) } @Test fun `merging states with movies starting the same day does not create a triggered state`() { - val oldState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "")) })) - val newState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 14, 30), "")) })) + val oldState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "", "")) })) + val newState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 14, 30), "", "")) })) val mergedState = merger.mergeStates(oldState, newState) as MovieState assertThat(mergedState.triggered(), equalTo(false)) } @Test fun `merging states with movies starting on different days does create a triggered state`() { - val oldState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "")) })) - val newState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "")) })) + val oldState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "", "")) })) + val newState = MovieState(setOf(Movie("1", "").apply { addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "", "")) })) val mergedState = merger.mergeStates(oldState, newState) as MovieState assertThat(mergedState.triggered(), equalTo(true)) } @@ -77,11 +77,11 @@ class SavoyMergerTest { @Test fun `merging states where movies have different performances but still on the same day does not create a triggered state`() { val oldState = MovieState(setOf(Movie("1", "").apply { - addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 14, 30), "")) - addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "")) + addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 14, 30), "", "")) + addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "", "")) })) val newState = MovieState(setOf(Movie("1", "").apply { - addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "")) + addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "", "")) })) val mergedState = merger.mergeStates(oldState, newState) as MovieState assertThat(mergedState.triggered(), equalTo(false)) @@ -90,11 +90,11 @@ class SavoyMergerTest { @Test fun `merging states where movies have different performances and are not on the same day anymore does create a triggered state`() { val oldState = MovieState(setOf(Movie("1", "").apply { - addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "")) - addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "")) + addPerformance(Performance(LocalDateTime.of(2024, 2, 14, 18, 45), "", "")) + addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "", "")) })) val newState = MovieState(setOf(Movie("1", "").apply { - addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "")) + addPerformance(Performance(LocalDateTime.of(2024, 2, 15, 14, 30), "", "")) })) val mergedState = merger.mergeStates(oldState, newState) as MovieState assertThat(mergedState.triggered(), equalTo(true)) -- 2.7.4