Show which slide show hours is fetched

This commit is contained in:
Guntis Smaukstelis
2025-02-23 20:21:11 +02:00
parent 6c9f544342
commit b6cc4a4b24
7 changed files with 65 additions and 25 deletions
+3 -1
View File
@@ -27,12 +27,14 @@ object DataService {
class DataService(log: Logger[IO]) {
val BASE_FOLDER = "data"
val GRIB_FOLDER = s"$BASE_FOLDER/grib"
val TMP_FOLDER = s"$BASE_FOLDER/tmp"
def init: IO[Unit] = {
for {
_ <- fs2.io.file.Files[IO].createDirectories(fs2.io.file.Path(BASE_FOLDER))
_ <- fs2.io.file.Files[IO].createDirectories(fs2.io.file.Path(GRIB_FOLDER))
_ <- log.info(s"Created directories: $BASE_FOLDER and $GRIB_FOLDER")
_ <- fs2.io.file.Files[IO].createDirectories(fs2.io.file.Path(TMP_FOLDER))
_ <- log.info(s"Created directories: $BASE_FOLDER, $GRIB_FOLDER, ${TMP_FOLDER}")
} yield ()
}
+1 -1
View File
@@ -78,7 +78,7 @@ class FetchService(dataService: DataService, log: Logger[IO]) {
request = Request[IO](Method.GET, urlWithParams)
// TODO proly better to call dataService method than property
tmpPath = Path(s"${dataService.GRIB_FOLDER}/tmp.grib")
tmpPath = Path(s"${dataService.TMP_FOLDER}/tmp.grib")
_ <- client.stream(request)
.flatMap(_.body)
.through(Files[IO].writeAll(tmpPath))