Less noisy logs for scrobble
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/deluan/navidrome/log"
|
||||||
"github.com/deluan/navidrome/model"
|
"github.com/deluan/navidrome/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -42,6 +43,9 @@ func (s *scrobbler) Register(ctx context.Context, playerId int, trackId string,
|
|||||||
err = s.ds.Artist(ctx).IncPlayCount(mf.ArtistID, playTime)
|
err = s.ds.Artist(ctx).IncPlayCount(mf.ArtistID, playTime)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
||||||
|
log.Info("Scrobbled", "title", mf.Title, "artist", mf.Artist, "user", userName(ctx))
|
||||||
|
|
||||||
return mf, err
|
return mf, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +60,8 @@ func (s *scrobbler) NowPlaying(ctx context.Context, playerId int, playerName, tr
|
|||||||
return nil, errors.New(fmt.Sprintf(`ID "%s" not found`, trackId))
|
return nil, errors.New(fmt.Sprintf(`ID "%s" not found`, trackId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Info("Now Playing", "title", mf.Title, "artist", mf.Artist, "user", userName(ctx))
|
||||||
|
|
||||||
info := &NowPlayingInfo{TrackID: trackId, Username: username, Start: time.Now(), PlayerId: playerId, PlayerName: playerName}
|
info := &NowPlayingInfo{TrackID: trackId, Username: username, Start: time.Now(), PlayerId: playerId, PlayerName: playerName}
|
||||||
return mf, s.npRepo.Enqueue(info)
|
return mf, s.npRepo.Enqueue(info)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,19 +125,17 @@ func (c *MediaAnnotationController) Scrobble(w http.ResponseWriter, r *http.Requ
|
|||||||
t = time.Now()
|
t = time.Now()
|
||||||
}
|
}
|
||||||
if submission {
|
if submission {
|
||||||
mf, err := c.scrobbler.Register(r.Context(), playerId, id, t)
|
_, err := c.scrobbler.Register(r.Context(), playerId, id, t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(r, "Error scrobbling track", "id", id, err)
|
log.Error(r, "Error scrobbling track", "id", id, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info(r, "Scrobbled", "id", id, "title", mf.Title, "timestamp", t)
|
|
||||||
} else {
|
} else {
|
||||||
mf, err := c.scrobbler.NowPlaying(r.Context(), playerId, playerName, id, username)
|
_, err := c.scrobbler.NowPlaying(r.Context(), playerId, playerName, id, username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(r, "Error setting current song", "id", id, err)
|
log.Error(r, "Error setting current song", "id", id, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info(r, "Now Playing", "id", id, "title", mf.Title, "timestamp", t)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NewResponse(), nil
|
return NewResponse(), nil
|
||||||
|
|||||||
Reference in New Issue
Block a user