From 6675c4d2320b5643c345c22565b075885aea2351 Mon Sep 17 00:00:00 2001 From: "T.v.Dein" Date: Mon, 10 Feb 2025 22:20:25 +0100 Subject: [PATCH] Fix/timeformat (#122) * Fix #121: confused day with month thanks to time.Format * Add outdir template variable example --- config.go | 4 ++-- example.conf | 6 ++++-- store.go | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/config.go b/config.go index 0b1bb84..27729be 100644 --- a/config.go +++ b/config.go @@ -1,5 +1,5 @@ /* -Copyright © 2023-2024 Thomas von Dein +Copyright © 2023-2025 Thomas von Dein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ import ( ) const ( - VERSION string = "0.3.16" + VERSION string = "0.3.17" Baseuri string = "https://www.kleinanzeigen.de" Listuri string = "/s-bestandsliste.html" Defaultdir string = "." diff --git a/example.conf b/example.conf index d1433ac..fd820e6 100644 --- a/example.conf +++ b/example.conf @@ -12,8 +12,10 @@ user = 00000000 loglevel = "verbose" # directory where to store downloaded ads. kleingebaeck will try to -# create it. must be a quoted string. -outdir = "test" +# create it. must be a quoted string. You can also include a couple of +# template variables, e.g: +# outdir = "test-{{.Year}}-{{.Month}}-{{.Day}}" +outdir = "test" # template for stored adlistings. template=""" diff --git a/store.go b/store.go index 120e4aa..08e25ea 100644 --- a/store.go +++ b/store.go @@ -1,5 +1,5 @@ /* -Copyright © 2023-2024 Thomas von Dein +Copyright © 2023-2025 Thomas von Dein This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,8 +44,8 @@ func OutDirName(conf *Config) (string, error) { now := time.Now() data := OutdirData{ Year: now.Format("2006"), - Month: now.Format("02"), - Day: now.Format("01"), + Month: now.Format("01"), + Day: now.Format("02"), } err = tmpl.Execute(&buf, data)