Various output tweaks

This commit is contained in:
Philipp Wolfer 2023-11-09 17:31:42 +01:00
parent e9b7aabc0a
commit 49d06b7f52
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
3 changed files with 9 additions and 9 deletions

View file

@ -49,7 +49,7 @@ type ImportResult struct {
func resolveBackend(config *viper.Viper) (string, Backend, error) {
backendName := config.GetString("backend")
fmt.Printf("requested backend %s\n", backendName)
// fmt.Printf("requested backend %s\n", backendName)
backendType := knownBackends[backendName]
if backendType == nil {
return backendName, nil, errors.New(fmt.Sprintf("Unknown backend %s", backendName))

View file

@ -39,10 +39,10 @@ func (b DumpBackend) ImportListens(listens []Listen, oldestTimestamp time.Time)
Count: len(listens),
LastTimestamp: oldestTimestamp,
}
if result.Count > 0 {
result.LastTimestamp = listens[len(listens)-1].ListenedAt
}
for _, listen := range listens {
if listen.ListenedAt.Unix() > result.LastTimestamp.Unix() {
result.LastTimestamp = listen.ListenedAt
}
fmt.Printf("Listen: \"%s\" by %s\n", listen.TrackName, listen.ArtistName())
}
return result, nil