New NowPlaying and Skip detection implementation

This commit is contained in:
Deluan
2016-03-23 10:06:26 -04:00
parent 59a0ab3793
commit c580a4199e
8 changed files with 127 additions and 91 deletions
+12 -3
View File
@@ -12,8 +12,17 @@ type NowPlayingInfo struct {
PlayerName string
}
// This repo has the semantics of a FIFO queue, for each playerId
type NowPlayingRepository interface {
Set(trackId, username string, playerId int, playerName string) error
Clear(playerId int) (*NowPlayingInfo, error)
GetAll() (*[]NowPlayingInfo, error)
// Insert at the head of the queue
Enqueue(playerId int, playerName string, trackId, username string) error
// Returns the element at the head of the queue (last inserted one)
Head(playerId int) (*NowPlayingInfo, error)
// Removes and returns the element at the end of the queue
Dequeue(playerId int) (*NowPlayingInfo, error)
// Returns all heads from all playerIds
GetAll() ([]*NowPlayingInfo, error)
}