Introduced NowPlayingRepository. Don't do anything for now

This commit is contained in:
Deluan
2016-03-16 20:27:48 -04:00
parent b660a70688
commit 4748ce142f
7 changed files with 76 additions and 4 deletions
+28
View File
@@ -0,0 +1,28 @@
package persistence
import (
"errors"
"time"
"github.com/deluan/gosonic/engine"
)
type nowPlayingRepository struct {
ledisRepository
}
func NewNowPlayingRepository() engine.NowPlayingRepository {
r := &nowPlayingRepository{}
r.init("nnowplaying", &engine.NowPlayingInfo{})
return r
}
func (r *nowPlayingRepository) Add(id string) error {
if id == "" {
return errors.New("Id is required")
}
m := &engine.NowPlayingInfo{TrackId: id, Start: time.Now()}
return r.saveOrUpdate(m.TrackId, m)
}
var _ engine.NowPlayingRepository = (*nowPlayingRepository)(nil)