refactor: remove annotation handling from engine

This commit is contained in:
Deluan
2020-01-30 22:07:02 -05:00
committed by Deluan Quintão
parent 67ed830a68
commit 72d9ddf532
20 changed files with 151 additions and 386 deletions
+2 -4
View File
@@ -24,8 +24,6 @@ type scrobbler struct {
}
func (s *scrobbler) Register(ctx context.Context, playerId int, trackId string, playTime time.Time) (*model.MediaFile, error) {
userId := getUserID(ctx)
var mf *model.MediaFile
var err error
err = s.ds.WithTx(func(tx model.DataStore) error {
@@ -33,11 +31,11 @@ func (s *scrobbler) Register(ctx context.Context, playerId int, trackId string,
if err != nil {
return err
}
err = s.ds.Annotation(ctx).IncPlayCount(userId, model.MediaItemType, trackId, playTime)
err = s.ds.Annotation(ctx).IncPlayCount(model.MediaItemType, trackId, playTime)
if err != nil {
return err
}
err = s.ds.Annotation(ctx).IncPlayCount(userId, model.AlbumItemType, mf.AlbumID, playTime)
err = s.ds.Annotation(ctx).IncPlayCount(model.AlbumItemType, mf.AlbumID, playTime)
return err
})
return mf, err