frontend

package
v0.0.0-...-6217932 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func About

func About(w http.ResponseWriter, r *djRequest)

About shows the about page.

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 Index

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

Index shows the homepage.

func Login

func Login(w http.ResponseWriter, r *djRequest)

func RegisterService

func RegisterService(ac *AppContext)
func Search(w http.ResponseWriter, r *djRequest)

Search returns full search results.

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.

func NewDavFs

func NewDavFs(fs fsapi.Filesystem, storage services.Storage) *DavFs

func (*DavFs) Get

func (davfs *DavFs) Get(w http.ResponseWriter, r *http.Request)

func (*DavFs) Ls

func (davfs *DavFs) Ls(path string) ([]webdav.Attrs, error)

func (*DavFs) Stat

func (davfs *DavFs) Stat(path string) (webdav.Attrs, error)

type JsonFs

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

func NewJsonFs

func NewJsonFs(fs fsapi.Filesystem) *JsonFs

func (*JsonFs) ServeHTTP

func (j *JsonFs) ServeHTTP(w http.ResponseWriter, r *djRequest)
type NavLink struct {
	Name    string
	Title   string
	Icon    string
	Link    string
	Current bool
}

type SearchEngine

type SearchEngine interface {
	Search(query string) ([]string, error)
	Index(md5 string, meta *api.Meta) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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