Documentation ¶
Index ¶
- Constants
- type BackendServer
- func (s *BackendServer) CreateRoom(con context.Context, room *bepb.Room) (*bepb.Room, error)
- func (s *BackendServer) GetNowPlaying(con context.Context, empty *cmpb.Empty) (*cmpb.Song, error)
- func (s *BackendServer) GetPlaylist(con context.Context, arg *cmpb.Empty) (*bepb.Playlist, error)
- func (s *BackendServer) GetRoom(con context.Context, room *bepb.Room) (*bepb.Room, error)
- func (s *BackendServer) LoginUser(con context.Context, user *bepb.User) (*bepb.User, error)
- func (s *BackendServer) NextSong(con context.Context, empty *cmpb.Empty) (*bepb.Error, error)
- func (s *BackendServer) PauseSong(con context.Context, empty *cmpb.Empty) (*bepb.Error, error)
- func (s *BackendServer) PopQueue(con context.Context, empty *cmpb.Empty) (*cmpb.Song, error)
- func (s *BackendServer) RemoveSong(con context.Context, eviction *bepb.Eviction) (*bepb.Error, error)
- func (s *BackendServer) SavePlaylist(con context.Context, fname *bepb.FilePath) (*bepb.Error, error)
- func (s *BackendServer) SendSong(con context.Context, sub *bepb.Submission) (*bepb.Error, error)
- func (s *BackendServer) Serve()
- func (s *BackendServer) SongPlayer(stream bepb.YtbBePlayer_SongPlayerServer) error
- func (s *BackendServer) Stop()
- type SongFetcher
- type UserCache
- type UserEntry
Constants ¶
const ( // The ready status is AND'd together to get an all-ready status PLAYER_BUSY = false PLAYER_READY = true )
const (
LogPrefix string = "ytb-be" // logging prefix name
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendServer ¶
type BackendServer struct { bepb.UnimplementedYtbBackendServer bepb.UnimplementedYtbBePlayerServer // contains filtered or unexported fields }
* Implements the backend rpc server interface
func NewServer ¶
func NewServer(addr string, loadFile string, dbPath string, ytApiKey string) *BackendServer
* Create a new yt_box backend server
func (*BackendServer) CreateRoom ¶
* Handles command to create a new room. Room names should be unique. Will * return an error if the room already exists.
func (*BackendServer) GetNowPlaying ¶
* Returns the song that should be considered "now playing". If there isn't a * current song, then an empty Song struct is returned.
func (*BackendServer) GetPlaylist ¶
* Returns the songs in the queue back to the requesting client
func (*BackendServer) LoginUser ¶
* Login the given user. If the userId is zero, then a new user needs to be * created. A successful call will echo the username and return a userId * greater than zero. An id of zero indicates an error occurred and the user * will not be considered to be logged in. An a user already exists with the * given id, but with a different name, then the new name shall be applied to * the database.
func (*BackendServer) NextSong ¶
* Forwards the command to skip the currently playing song onto the remote * player
func (*BackendServer) PauseSong ¶
* Forwards the command to pause the currently playing song onto the remote * player
func (*BackendServer) RemoveSong ¶
func (s *BackendServer) RemoveSong(con context.Context, eviction *bepb.Eviction) (*bepb.Error, error)
* Removes the given song from the playlist. The user identified by the song * eviction must match the id of the user who submitted the song.
func (*BackendServer) SavePlaylist ¶
func (s *BackendServer) SavePlaylist(con context.Context, fname *bepb.FilePath) (*bepb.Error, error)
* Saves the current playlist to the given file location
func (*BackendServer) SendSong ¶
func (s *BackendServer) SendSong(con context.Context, sub *bepb.Submission) (*bepb.Error, error)
* Receive a song from a remote client for appending to the play queue
func (*BackendServer) SongPlayer ¶
func (s *BackendServer) SongPlayer(stream bepb.YtbBePlayer_SongPlayerServer) error
* Stream RPC connection with the remote player client
type SongFetcher ¶
type SongFetcher struct {
// contains filtered or unexported fields
}
type UserCache ¶
type UserCache struct {
// contains filtered or unexported fields
}
func (*UserCache) AddUserToCache ¶
* Adds a username and id to the cache