Documentation ¶
Index ¶
- func About(w http.ResponseWriter, r *djRequest)
- func ActivateUser(w http.ResponseWriter, r *djRequest)
- func AddPlayLog(w http.ResponseWriter, r *djRequest)
- func AnalyzeAndStore(ac *AppContext, localPath string)
- func ArtistAutocomplete(w http.ResponseWriter, r *djRequest)
- func CheckFingerprints(w http.ResponseWriter, r *djRequest)
- func Download(w http.ResponseWriter, r *djRequest)
- func GetAlbumArt(w http.ResponseWriter, r *djRequest)
- func GetManySongsInfo(w http.ResponseWriter, r *djRequest)
- func GetSongInfo(w http.ResponseWriter, r *djRequest)
- func Index(w http.ResponseWriter, r *djRequest)
- func Login(w http.ResponseWriter, r *djRequest)
- func RegisterService(ac *AppContext)
- func Search(w http.ResponseWriter, r *djRequest)
- func SearchIds(w http.ResponseWriter, r *djRequest)
- func Suggest(w http.ResponseWriter, r *djRequest)
- func Upload(w http.ResponseWriter, r *djRequest)
- func UserCreateAuthKey(w http.ResponseWriter, r *djRequest)
- func UserDeleteAuthKey(w http.ResponseWriter, r *djRequest)
- func UserGetAuthKeys(w http.ResponseWriter, r *djRequest)
- func UserPage(w http.ResponseWriter, r *djRequest)
- func WithApiAuth(h djHandler) djHandler
- func WithBasicAuth(h djHandler) djHandler
- func WithRequest(ac *AppContext, h djHandler) http.Handler
- func WithUserAuth(h djHandler) djHandler
- type AppContext
- type DavFs
- type JsonFs
- type NavLink
- type SearchEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivateUser ¶
func ActivateUser(w http.ResponseWriter, r *djRequest)
func AddPlayLog ¶
func AddPlayLog(w http.ResponseWriter, r *djRequest)
AddPlayLog adds an entry to the play log.
func AnalyzeAndStore ¶
func AnalyzeAndStore(ac *AppContext, localPath string)
AnalyzeAndStore implements the background processing pipeline for incoming files. At this stage, the file still exists on the local filesystem.
Once the song is in the database, further processing and analysis is delegated to the background processing nodes via the queue service (i.e. we initialize the song state machine at the end of this function).
func ArtistAutocomplete ¶
func ArtistAutocomplete(w http.ResponseWriter, r *djRequest)
ArtistAutocomplete returns artist autocompletion results.
func CheckFingerprints ¶
func CheckFingerprints(w http.ResponseWriter, r *djRequest)
CheckFingerprints verifies if songs are already in the db.
func Download ¶
func Download(w http.ResponseWriter, r *djRequest)
Download retrieves the song data from storage.
func GetAlbumArt ¶
func GetAlbumArt(w http.ResponseWriter, r *djRequest)
GetAlbumArt returns art for an album.
func GetManySongsInfo ¶
func GetManySongsInfo(w http.ResponseWriter, r *djRequest)
GetManySongsInfo returns data on many songs.
func GetSongInfo ¶
func GetSongInfo(w http.ResponseWriter, r *djRequest)
GetSongInfo returns data on a specific song.
func Login ¶
func Login(w http.ResponseWriter, r *djRequest)
func RegisterService ¶
func RegisterService(ac *AppContext)
func SearchIds ¶
func SearchIds(w http.ResponseWriter, r *djRequest)
SearchIds runs a search query and returns only song IDs.
func Suggest ¶
func Suggest(w http.ResponseWriter, r *djRequest)
Suggest builds a (short) playlist based on a seed, using a mix of the Markov models for the user and the global one. The function will try to generate a playlist containing the requested number of songs; if at any step the Markov models can't provide a suggestion, a random song will be inserted.
func Upload ¶
func Upload(w http.ResponseWriter, r *djRequest)
Upload receives files from sync clients, saves them to permanent storage and creates new Song objects in the db.
func UserCreateAuthKey ¶
func UserCreateAuthKey(w http.ResponseWriter, r *djRequest)
func UserDeleteAuthKey ¶
func UserDeleteAuthKey(w http.ResponseWriter, r *djRequest)
func UserGetAuthKeys ¶
func UserGetAuthKeys(w http.ResponseWriter, r *djRequest)
func UserPage ¶
func UserPage(w http.ResponseWriter, r *djRequest)
func WithApiAuth ¶
func WithApiAuth(h djHandler) djHandler
WithApiAuth wraps a djHandler with API-key based authentication. Session-based authentication is tried first (for interactive usage).
func WithBasicAuth ¶
func WithBasicAuth(h djHandler) djHandler
WithBasicAuth enforces usage of Basic HTTP authentication.
func WithRequest ¶
func WithRequest(ac *AppContext, h djHandler) http.Handler
func WithUserAuth ¶
func WithUserAuth(h djHandler) djHandler
WithUserAuth wraps a djHandler with session-based authentication.
Types ¶
type AppContext ¶
type AppContext struct { // Services. Db services.Database Storage services.Storage TaskClient services.TaskClient Index services.Index // HTTP server specific runtime globals. AlbumArt *albumart.AlbumArtCache SessionStore sessions.Store Template *template.Template XsrfSecret string }
func (*AppContext) Authenticate ¶
func (ac *AppContext) Authenticate(username, password string) (*api.User, error)
Authenticate attempts to authenticate the specified user.
func (*AppContext) RenderTemplate ¶
func (ac *AppContext) RenderTemplate(w http.ResponseWriter, templateName string, ctx interface{})
RenderTemplate safely renders a template for an HTTP response.
type DavFs ¶
type DavFs struct {
// contains filtered or unexported fields
}
DavFs implements a filesystem in terms of the webdavi.Fs interface. It exports a "/artist/album/song_title" filesystem hierarchy.