Documentation
¶
Overview ¶
Package subsonic provides the Subsonic emulation layer of the wavepipe media server.
Index ¶
- Constants
- Variables
- func GetAlbum(res http.ResponseWriter, req *http.Request)
- func GetAlbumList2(res http.ResponseWriter, req *http.Request)
- func GetCoverArt(res http.ResponseWriter, req *http.Request)
- func GetIndexes(res http.ResponseWriter, req *http.Request)
- func GetLicense(res http.ResponseWriter, req *http.Request)
- func GetMusicDirectory(res http.ResponseWriter, req *http.Request)
- func GetMusicFolders(res http.ResponseWriter, req *http.Request)
- func GetPlaylists(res http.ResponseWriter, req *http.Request)
- func GetRandomSongs(res http.ResponseWriter, req *http.Request)
- func GetStarred(res http.ResponseWriter, req *http.Request)
- func Ping(res http.ResponseWriter, req *http.Request)
- func Stream(res http.ResponseWriter, req *http.Request)
- type Album
- type AlbumList2Container
- type Artist
- type Child
- type Container
- type Error
- type Index
- type IndexesContainer
- type License
- type MusicDirectoryContainer
- type MusicFolder
- type MusicFoldersContainer
- type Playlists
- type RandomSongsContainer
- type Song
- type Starred
- Bugs
Constants ¶
const ( // XMLName is the top-level name of a Subsonic XML response XMLName = "subsonic-response" // XMLNS is the XML namespace of a Subsonic XML response XMLNS = "http://subsonic.org/restapi" // Version is the emulated Subsonic API version Version = "1.8.0" )
Variables ¶
var ( // ErrBadCredentials returns a bad credentials response ErrBadCredentials = func() *Container { c := newContainer() c.Status = "failed" c.SubError = &Error{Code: 40, Message: "Wrong username or password."} return c }() // ErrGeneric returns a generic error response, such as a server issue ErrGeneric = func() *Container { c := newContainer() c.Status = "failed" c.SubError = &Error{Code: 0, Message: "An error occurred."} return c }() // ErrMissingParameter returns a missing required parameter response ErrMissingParameter = func() *Container { c := newContainer() c.Status = "failed" c.SubError = &Error{Code: 10, Message: "Required parameter is missing."} return c }() )
Functions ¶
func GetAlbum ¶
func GetAlbum(res http.ResponseWriter, req *http.Request)
GetAlbum is used in Subsonic to return a single album
func GetAlbumList2 ¶
func GetAlbumList2(res http.ResponseWriter, req *http.Request)
GetAlbumList2 is used in Subsonic to return a list of albums organized with tags
func GetCoverArt ¶
func GetCoverArt(res http.ResponseWriter, req *http.Request)
GetCoverArt is used in Subsonic to retrieve cover art, specifying an ID and a size
func GetIndexes ¶
func GetIndexes(res http.ResponseWriter, req *http.Request)
GetIndexes is used in Subsonic to return an alphabetical index of artists and IDs
func GetLicense ¶
func GetLicense(res http.ResponseWriter, req *http.Request)
GetLicense is used in Subsonic to return information about the server's license
func GetMusicDirectory ¶
func GetMusicDirectory(res http.ResponseWriter, req *http.Request)
GetMusicDirectory is used in Subsonic to return a list of filesystem items contained in a directory, including songs, folders, etc.
func GetMusicFolders ¶
func GetMusicFolders(res http.ResponseWriter, req *http.Request)
GetMusicFolders is used in Subsonic to return a list of music folders. Since wavepipe only has one, we only return one.
func GetPlaylists ¶
func GetPlaylists(res http.ResponseWriter, req *http.Request)
GetPlaylists is used in Subsonic to return playlists from the server
func GetRandomSongs ¶
func GetRandomSongs(res http.ResponseWriter, req *http.Request)
GetRandomSongs is used in Subsonic to return a list of random songs
func GetStarred ¶
func GetStarred(res http.ResponseWriter, req *http.Request)
GetStarred is used in Subsonic to return favorite items from the server
Types ¶
type Album ¶
type Album struct {
// Subsonic fields
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
Artist string `xml:"artist,attr"`
ArtistID int `xml:"artistId,attr"`
CoverArt string `xml:"coverArt,attr"`
SongCount int `xml:"songCount,attr"`
Duration int `xml:"duration,attr"`
Created string `xml:"created,attr"`
// getAlbum.view
Songs []Song `xml:"song"`
}
Album represents an emulated Subsonic album
type AlbumList2Container ¶
type AlbumList2Container struct {
// Container name
XMLName xml.Name `xml:"albumList2,omitempty"`
// Albums
Albums []Album `xml:"album"`
}
AlbumList2Container contains a list of emulated Subsonic albums, by tags
type Artist ¶
type Artist struct {
XMLName xml.Name `xml:"artist,omitempty"`
// Subsonic fields
Name string `xml:"name,attr"`
ID string `xml:"id,attr"`
}
Artist represents an emulated Subsonic artist
type Child ¶
type Child struct {
// Container name
XMLName xml.Name `xml:"child,omitempty"`
// Attributes
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Album string `xml:"album,attr"`
Artist string `xml:"artist,attr"`
IsDir bool `xml:"isDir,attr"`
CoverArt int `xml:"coverArt,attr"`
Created string `xml:"created,attr"`
}
Child is any item displayed to Subsonic when browsing using getMusicDirectory
type Container ¶
type Container struct {
// Top-level container name
XMLName xml.Name `xml:"subsonic-response"`
// Attributes which are always present
XMLNS string `xml:"xmlns,attr"`
Status string `xml:"status,attr"`
Version string `xml:"version,attr"`
// Error, returned on failures
SubError *Error
// getAlbum.view
Album []Album `xml:"album"`
// getAlbumList2.view
AlbumList2 *AlbumList2Container
// getIndexes.view
Indexes *IndexesContainer
// getLicense.view
License *License `xml:"license"`
// getMusicDirectory.view
MusicDirectory *MusicDirectoryContainer
// getMusicFolders.view
MusicFolders *MusicFoldersContainer
// getPlaylists.view
Playlists *Playlists `xml:"playlists"`
// getRandomSongs.view
RandomSongs *RandomSongsContainer
// getStarred.view
Starred *Starred `xml:"starred"`
}
Container is the top-level emulated Subsonic response
type Error ¶
type Error struct {
XMLName xml.Name `xml:"error,omitempty"`
Code int `xml:"code,attr"`
Message string `xml:"message,attr"`
}
Error contains a Subsonic error, with status code and message
type Index ¶
type Index struct {
XMLName xml.Name `xml:"index"`
Name string `xml:"name,attr"`
Artists []Artist `xml:"artist"`
}
Index represents an alphabetical Subsonic index
type IndexesContainer ¶
type IndexesContainer struct {
XMLName xml.Name `xml:"indexes,omitempty"`
LastModified int64 `xml:"lastModified,attr"`
Indexes []Index `xml:"index"`
}
IndexesContainer represents a Subsonic indexes container
type License ¶
type License struct {
XMLName xml.Name `xml:"license,omitempty"`
Valid bool `xml:"valid,attr"`
Email string `xml:"email,attr"`
Key string `xml:"key,attr"`
Date string `xml:"date,attr"`
}
License represents a Subsonic license
type MusicDirectoryContainer ¶
type MusicDirectoryContainer struct {
// Container name
XMLName xml.Name `xml:"directory,omitempty"`
// Attributes
ID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Children []Child `xml:"child"`
}
MusicDirectoryContainer contains a list of emulated Subsonic music folders
type MusicFolder ¶
MusicFolder represents an emulated Subsonic music folder
type MusicFoldersContainer ¶
type MusicFoldersContainer struct {
// Container name
XMLName xml.Name `xml:"musicFolders,omitempty"`
// Music folders
MusicFolders []MusicFolder `xml:"musicFolder"`
}
MusicFoldersContainer contains a list of emulated Subsonic music folders
type RandomSongsContainer ¶
type RandomSongsContainer struct {
// Container name
XMLName xml.Name `xml:"randomSongs,omitempty"`
// Songs
Songs []Song `xml:"song"`
}
RandomSongsContainer contains a random list of emulated Subsonic songs
type Song ¶
type Song struct {
ID int `xml:"id,attr"`
Parent int `xml:"parent,attr"`
Title string `xml:"title,attr"`
Album string `xml:"album,attr"`
Artist string `xml:"artist,attr"`
IsDir bool `xml:"isDir,attr"`
CoverArt string `xml:"coverArt,attr"`
Created string `xml:"created,attr"`
Duration int `xml:"duration,attr"`
BitRate int `xml:"bitRate,attr"`
Track int `xml:"track,attr"`
DiscNumber int `xml:"discNumber,attr"`
Year int `xml:"year,attr"`
Genre string `xml:"genre,attr"`
Size int64 `xml:"size,attr"`
Suffix string `xml:"suffix,attr"`
ContentType string `xml:"contentType,attr"`
IsVideo bool `xml:"isVideo,attr"`
Path string `xml:"path,attr"`
AlbumID int `xml:"albumId,attr"`
ArtistID int `xml:"artistId,attr"`
Type string `xml:"type,attr"`
}
Song represents an emulated Subsonic song
Notes ¶
Bugs ¶
subsonic: wavepipe has no concept of a parent item, so leave blank?
subsonic: wavepipe cannot scan disc number without taggolib