mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-16 04:00:38 +03:00
Removed 'submit' parameter
This commit is contained in:
parent
4748ce142f
commit
f6866f23a0
@ -24,7 +24,7 @@ func (c *MediaAnnotationController) Scrobble() {
|
||||
time := c.ParamTime("time", time.Now())
|
||||
submission := c.ParamBool("submission", false)
|
||||
if submission {
|
||||
mf, err := c.scrobbler.Register(id, time, true)
|
||||
mf, err := c.scrobbler.Register(id, time)
|
||||
if err != nil {
|
||||
beego.Error("Error scrobbling:", err)
|
||||
c.SendError(responses.ERROR_GENERIC, "Internal error")
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type Scrobbler interface {
|
||||
Register(id string, playDate time.Time, submit bool) (*domain.MediaFile, error)
|
||||
Register(id string, playDate time.Time) (*domain.MediaFile, error)
|
||||
}
|
||||
|
||||
func NewScrobbler(itunes itunesbridge.ItunesControl, mr domain.MediaFileRepository, npr NowPlayingRepository) Scrobbler {
|
||||
@ -23,7 +23,7 @@ type scrobbler struct {
|
||||
npRepo NowPlayingRepository
|
||||
}
|
||||
|
||||
func (s scrobbler) Register(id string, playDate time.Time, submit bool) (*domain.MediaFile, error) {
|
||||
func (s scrobbler) Register(id string, playDate time.Time) (*domain.MediaFile, error) {
|
||||
mf, err := s.mfRepo.Get(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -33,10 +33,8 @@ func (s scrobbler) Register(id string, playDate time.Time, submit bool) (*domain
|
||||
return nil, errors.New(fmt.Sprintf(`Id "%s" not found`, id))
|
||||
}
|
||||
|
||||
if submit {
|
||||
if err := s.itunes.MarkAsPlayed(id, playDate); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.itunes.MarkAsPlayed(id, playDate); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mf, nil
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ func TestScrobbler(t *testing.T) {
|
||||
|
||||
Convey("When I scrobble an existing song", func() {
|
||||
now := time.Now()
|
||||
mf, err := scrobbler.Register("2", now, true)
|
||||
mf, err := scrobbler.Register("2", now)
|
||||
|
||||
Convey("Then I get the scrobbled song back", func() {
|
||||
So(err, ShouldBeNil)
|
||||
@ -42,7 +42,7 @@ func TestScrobbler(t *testing.T) {
|
||||
})
|
||||
|
||||
Convey("When the ID is not in the DB", func() {
|
||||
_, err := scrobbler.Register("3", time.Now(), true)
|
||||
_, err := scrobbler.Register("3", time.Now())
|
||||
|
||||
Convey("Then I receive an error", func() {
|
||||
So(err, ShouldNotBeNil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user