mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-10 18:27:03 +02:00
Fix scrobblerlog timezone not being set from config
This commit is contained in:
parent
bd7a35cd68
commit
8885e9cebc
1 changed files with 8 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright © 2023 Philipp Wolfer <phw@uploadedlobster.com>
|
Copyright © 2023-2025 Philipp Wolfer <phw@uploadedlobster.com>
|
||||||
|
|
||||||
This file is part of Scotty.
|
This file is part of Scotty.
|
||||||
|
|
||||||
|
@ -67,18 +67,19 @@ func (b *ScrobblerLogBackend) InitConfig(config *config.ServiceConfig) error {
|
||||||
b.filePath = config.GetString("file-path")
|
b.filePath = config.GetString("file-path")
|
||||||
b.ignoreSkipped = config.GetBool("ignore-skipped", true)
|
b.ignoreSkipped = config.GetBool("ignore-skipped", true)
|
||||||
b.append = config.GetBool("append", true)
|
b.append = config.GetBool("append", true)
|
||||||
timezone := config.GetString("time-zone")
|
b.log = scrobblerlog.ScrobblerLog{
|
||||||
if timezone != "" {
|
TZ: scrobblerlog.TimezoneUTC,
|
||||||
|
Client: "Rockbox unknown $Revision$",
|
||||||
|
}
|
||||||
|
|
||||||
|
if timezone := config.GetString("time-zone"); timezone != "" {
|
||||||
location, err := time.LoadLocation(timezone)
|
location, err := time.LoadLocation(timezone)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Invalid time-zone %q: %w", timezone, err)
|
return fmt.Errorf("Invalid time-zone %q: %w", timezone, err)
|
||||||
}
|
}
|
||||||
b.log.FallbackTimezone = location
|
b.log.FallbackTimezone = location
|
||||||
}
|
}
|
||||||
b.log = scrobblerlog.ScrobblerLog{
|
|
||||||
TZ: scrobblerlog.TimezoneUTC,
|
|
||||||
Client: "Rockbox unknown $Revision$",
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue