mirror of
https://git.sr.ht/~phw/scotty
synced 2025-05-09 18:07: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.
|
||||
|
||||
|
@ -67,18 +67,19 @@ func (b *ScrobblerLogBackend) InitConfig(config *config.ServiceConfig) error {
|
|||
b.filePath = config.GetString("file-path")
|
||||
b.ignoreSkipped = config.GetBool("ignore-skipped", true)
|
||||
b.append = config.GetBool("append", true)
|
||||
timezone := config.GetString("time-zone")
|
||||
if timezone != "" {
|
||||
b.log = scrobblerlog.ScrobblerLog{
|
||||
TZ: scrobblerlog.TimezoneUTC,
|
||||
Client: "Rockbox unknown $Revision$",
|
||||
}
|
||||
|
||||
if timezone := config.GetString("time-zone"); timezone != "" {
|
||||
location, err := time.LoadLocation(timezone)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Invalid time-zone %q: %w", timezone, err)
|
||||
}
|
||||
b.log.FallbackTimezone = location
|
||||
}
|
||||
b.log = scrobblerlog.ScrobblerLog{
|
||||
TZ: scrobblerlog.TimezoneUTC,
|
||||
Client: "Rockbox unknown $Revision$",
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue