Documentation
¶
Index ¶
- Constants
- type FifoQueuer
- type RoundRobinQueuer
- type SongQueueManager
- func (manager *SongQueueManager) AddSong(song *cmpb.Song)
- func (manager *SongQueueManager) ClearNowPlaying()
- func (manager *SongQueueManager) GetPlaylist() *bepb.Playlist
- func (manager *SongQueueManager) Init(queuer songQueuer)
- func (manager *SongQueueManager) Len() int
- func (manager *SongQueueManager) NowPlaying() *cmpb.Song
- func (manager *SongQueueManager) PopQueue() *cmpb.Song
- func (manager *SongQueueManager) RemoveSong(songId uint32, userId uint32) error
- func (manager *SongQueueManager) SavePlaylist(path string) error
- func (manager *SongQueueManager) WaitForMoreSongs()
Constants ¶
const (
QueueSnapshot string = "/tmp/ytbox.queue" // location of the queue snapshot
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FifoQueuer ¶
type FifoQueuer struct {
// contains filtered or unexported fields
}
* Contains the state data for the queue
func NewFifoQueuer ¶
func NewFifoQueuer() *FifoQueuer
func (*FifoQueuer) RemoveSong ¶
func (fifo *FifoQueuer) RemoveSong(songId uint32, userId uint32) error
type RoundRobinQueuer ¶
type RoundRobinQueuer struct {
// contains filtered or unexported fields
}
func NewRoundRobinQueuer ¶
func NewRoundRobinQueuer() *RoundRobinQueuer
type SongQueueManager ¶
type SongQueueManager struct {
// contains filtered or unexported fields
}
* Manages the song queue
func (*SongQueueManager) AddSong ¶
func (manager *SongQueueManager) AddSong(song *cmpb.Song)
* Adds a song to the queue
func (*SongQueueManager) ClearNowPlaying ¶
func (manager *SongQueueManager) ClearNowPlaying()
* Clear the now playing state
func (*SongQueueManager) GetPlaylist ¶
func (manager *SongQueueManager) GetPlaylist() *bepb.Playlist
* Returns a list of songs in the queue
func (*SongQueueManager) Init ¶
func (manager *SongQueueManager) Init(queuer songQueuer)
* Initializes the queue
func (*SongQueueManager) Len ¶
func (manager *SongQueueManager) Len() int
* Returns the length of the queue
func (*SongQueueManager) NowPlaying ¶
func (manager *SongQueueManager) NowPlaying() *cmpb.Song
* Returns the data for the currently playing song
func (*SongQueueManager) PopQueue ¶
func (manager *SongQueueManager) PopQueue() *cmpb.Song
* Pops the next song off the queue and returns it
func (*SongQueueManager) RemoveSong ¶
func (manager *SongQueueManager) RemoveSong(songId uint32, userId uint32) error
* Removes the identified song from the queue. Both the song id and uesr id * must match in order for the song to be successfully removed.
func (*SongQueueManager) SavePlaylist ¶
func (manager *SongQueueManager) SavePlaylist(path string) error
* Saves the playlist to a file
func (*SongQueueManager) WaitForMoreSongs ¶
func (manager *SongQueueManager) WaitForMoreSongs()
* Blocks the current thread while the size of the playlist is zero. The playlist * will notify all blocked threads that the size is once again greater than one * when a new song is added.