server

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2015 License: ISC Imports: 31 Imported by: 0

Documentation

Overview

Package server implements the mog protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FS

func FS(useLocal bool) http.FileSystem

FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func Index

func Index(w http.ResponseWriter, r *http.Request)

func JSON

func JSON(h func(url.Values, httprouter.Params) (interface{}, error)) httprouter.Handle

func ListenAndServe

func ListenAndServe(stateFile, addr string, devMode bool) error

Types

type Playlist

type Playlist []SongID

type PlaylistInfo

type PlaylistInfo []listItem

type Seek added in v0.0.2

type Seek struct {
	// contains filtered or unexported fields
}

func NewSeek added in v0.0.2

func NewSeek(canSeek bool, sr time.Duration, f func(int) ([]float32, error)) *Seek

func (*Seek) Pos added in v0.0.2

func (s *Seek) Pos() time.Duration

func (*Seek) Read added in v0.0.2

func (s *Seek) Read(n int) (b []float32, err error)

func (*Seek) Seek added in v0.0.2

func (s *Seek) Seek(offset time.Duration) error

Seek sets the offset for the next Read to offset, relative to the origin of the file.

type Server

type Server struct {
	Queue     Playlist
	Playlists map[string]Playlist

	Repeat    bool
	Random    bool
	Protocols map[string]map[string]protocol.Instance

	// Current song data.
	PlaylistIndex int
	// contains filtered or unexported fields
}

func New

func New(stateFile string) (*Server, error)

func (*Server) Cmd

func (srv *Server) Cmd(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) Data

func (srv *Server) Data(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) GetInstance

func (srv *Server) GetInstance(name, key string) (protocol.Instance, error)

func (*Server) GetMux

func (srv *Server) GetMux(devMode bool) *http.ServeMux

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe(addr string, devMode bool) error

ListenAndServe listens on the TCP network address addr and then calls Serve to handle requests on incoming connections.

func (*Server) OAuth

func (srv *Server) OAuth(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

func (*Server) PlaylistChange

func (srv *Server) PlaylistChange(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) ProtocolAdd

func (srv *Server) ProtocolAdd(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) ProtocolRefresh

func (srv *Server) ProtocolRefresh(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) ProtocolRemove

func (srv *Server) ProtocolRemove(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) QueueChange

func (srv *Server) QueueChange(form url.Values, ps httprouter.Params) (interface{}, error)

func (*Server) WebSocket

func (srv *Server) WebSocket(ws *websocket.Conn)

type SongID

type SongID struct {
	Protocol string
	Key      string
	ID       string
}

func ParseSongID

func ParseSongID(s string) (id SongID, err error)

func (SongID) MarshalJSON

func (s SongID) MarshalJSON() ([]byte, error)

func (SongID) String

func (s SongID) String() string

type State

type State int

func (State) String

func (s State) String() string

type Status

type Status struct {
	// Playback state
	State State
	// Song ID.
	Song     SongID
	SongInfo codec.SongInfo
	// Elapsed time of current song.
	Elapsed time.Duration
	// Duration of current song.
	Time   time.Duration
	Random bool
	Repeat bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL