From 79360efdf41b00a13ab69fffbf7e6844a14cbb8b Mon Sep 17 00:00:00 2001 From: chrisly42 Date: Fri, 28 Nov 2025 10:50:07 +0100 Subject: [PATCH] Prepare for 2025. --- build.gradle.kts | 2 +- src/downloader/Downloader.kt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ce25b2d..49d0692 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { dependencies { implementation("com.github.kittinunf.fuel:fuel:3.0.0-alpha1") - implementation("com.mohamedrejeb.ksoup:ksoup-html:0.4.0") + implementation("com.mohamedrejeb.ksoup:ksoup-html:0.6.0") } tasks { diff --git a/src/downloader/Downloader.kt b/src/downloader/Downloader.kt index 6af064a..adf46ea 100644 --- a/src/downloader/Downloader.kt +++ b/src/downloader/Downloader.kt @@ -23,7 +23,7 @@ fun main() { cookie = props.getProperty("cookie", cookie) } - val downloader = Downloader(2024, "aoc2024", cookie) + val downloader = Downloader(2025, "aoc2025", cookie) downloader.updateToLatest() } @@ -43,14 +43,15 @@ class Downloader(val year: Int, val packageName: String, val sessionCookie: Stri Files.createDirectories(targetDir) } val now = LocalDate.now(ZoneId.of("UTC-1")) - val lastDay = if (now.isBefore(LocalDate.of(year, Month.DECEMBER, 25))) { + val maxPuzzles = if (year < 2025) 25 else 12 + val lastDay = if (now.isBefore(LocalDate.of(year, Month.DECEMBER, maxPuzzles))) { if (now.isAfter(LocalDate.of(year, Month.NOVEMBER, 30))) { now.dayOfMonth } else { throw IllegalStateException("You're too early.") } } else { - 25 + maxPuzzles } for (day in 1..lastDay) {