Documentation ¶
Index ¶
- func InitDB() *gorp.DbMap
- func ReadConfig(filename string) (map[string]string, error)
- func WatchMPD(host string, handler *Handler)
- type Handler
- type MPDClient
- func (c *MPDClient) Add(uri string) error
- func (c *MPDClient) CurrentSong() (map[string]string, error)
- func (c *MPDClient) GetAlbums(artist string) (map[string][]string, error)
- func (c *MPDClient) GetArtists() ([]string, error)
- func (c *MPDClient) GetFiles() ([]map[string]string, error)
- func (c *MPDClient) GetPlaylist() ([]map[string]string, error)
- func (c *MPDClient) GetSongs(artist string, album string) ([]map[string]string, error)
- func (c *MPDClient) GetUpcoming() ([]map[string]string, error)
- func (c *MPDClient) KillMpd()
- func (c *MPDClient) QueueSong()
- func (c *MPDClient) ScanLibrary()
- func (c *MPDClient) Search(query string) ([]map[string]string, error)
- func (c *MPDClient) SearchAlbums(query string) []string
- func (c *MPDClient) SearchArtists(query string) []string
- func (c *MPDClient) SearchSongs(query string) []map[string]string
- func (c *MPDClient) Startup() error
- type Song
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadConfig ¶
ReadConfig reads a configuration yaml file and spits out a map of the keys we care about.
Types ¶
type Handler ¶
type Handler struct { // MpdClient is our MPD Client, used to tell MPD to do things. Important // things. MpdClient *MPDClient // ServerConfig is a map of configuration key/values found in // a config.yaml file. ServerConfig map[string]string // Router is a mux.Router, it's what really does all the HTTP stuff, we just // act as the interface. And the HandlerFuncs Router *mux.Router // contains filtered or unexported fields }
Handler is our custom http.Handler used to actually do the HTTP stuff.
func NewHandler ¶
NewHandler creates a new Handler, using the passed in filename as a yaml file containing the server's configuation settings.
func (*Handler) HandleFunc ¶
func (h *Handler) HandleFunc(path string, f func(w http.ResponseWriter, r *http.Request)) *mux.Route
HandleFunc make Handler extendible... Same as ServeHTTP, just pass up the Router's function.
func (*Handler) ListenAndServe ¶
ListenAndServe serve up some TurboWookie. And setup an MPD Watcher to see when things happen to the stream. Because things sometimes happen to the stream.
func (*Handler) PolarChanged ¶
PolarChanged tell clients connected to our long-poll system that something (element) has changed.
type MPDClient ¶
type MPDClient struct { // Domain MPD's running on Domain string // Port MPD's running on Port string // Underlying command running MPD MpdCmd *exec.Cmd // contains filtered or unexported fields }
MPDClient is a simpler layer over a gompd/mpd.Client.
func NewMPDClient ¶
NewMPDClient creates a new MPDClient. Takes in a config map (typically retreived from a config.yaml file), and a noStartMPD bool (which, if true will NOT start MPD . If it's false (and it should default to false), it will start MPD as expected).
func (*MPDClient) Add ¶
Add adds the specified uri to the playlist. uri can be a directory or file. uri must be relative to MPD's music directory.
func (*MPDClient) CurrentSong ¶
CurrentSong returns information about the song currently playing.
func (*MPDClient) GetArtists ¶
func (*MPDClient) GetFiles ¶
GetFiles returns a map of all songs in the library, and their stored metadata (artist, album, etc).
func (*MPDClient) GetPlaylist ¶
GetPlaylist returns the entire playlist queue, played and unplayed.
func (*MPDClient) GetUpcoming ¶
GetUpcoming returns a list of all upcoming songs in the queue, and their metadata.
func (*MPDClient) ScanLibrary ¶
func (c *MPDClient) ScanLibrary()