Documentation
¶
Overview ¶
Package gosubsonic provides a Subsonic client library, written in Go.
Index ¶
- Constants
- type APIError
- type APIStatus
- type Audio
- type Client
- func (s Client) Download(id int64) (io.ReadCloser, error)
- func (s Client) GetCoverArt(id int64, size int64) (io.ReadCloser, error)
- func (s Client) GetIndexes(folderID int64, modified int64) ([]Index, error)
- func (s Client) GetLicense() (*License, error)
- func (s Client) GetMusicDirectory(folderID int64) (*Content, error)
- func (s Client) GetMusicFolders() ([]MusicFolder, error)
- func (s Client) GetNowPlaying() ([]NowPlaying, error)
- func (s Client) Ping() (*APIStatus, error)
- func (s Client) Scrobble(id int64, time int64, submission bool) error
- func (s Client) Stream(id int64, options *StreamOptions) (io.ReadCloser, error)
- type Content
- type Directory
- type Index
- type IndexArtist
- type License
- type MusicFolder
- type NowPlaying
- type StreamOptions
- type Video
Constants ¶
const ( CLIENT = "gosubsonic-git-master" APIVERSION = "1.8.0" )
Constants to pass with each API request
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIStatus ¶
type APIStatus struct {
// Common fields
Status string
Version string
Xmlns string
// API error - returned only when an error occurs
Error APIError
// license - returned only in GetLicense
License License
// musicFolders - returned only in GetMusicFolders
MusicFolders apiMusicFolderContainer
// indexes - returned only in GetIndexes
Indexes apiIndexesContainer
// directory - returned only in GetMusicDirectory
Directory apiMusicDirectoryContainer
// nowPlaying - returned only in GetNowPlaying
NowPlaying interface{}
}
APIStatus represents the current status of Subsonic
type Audio ¶
type Audio struct {
// Raw values
ID int64
Album string
AlbumID int64
Artist string
ArtistID int64
BitRate int64
ContentType string
CoverArt int64
CreatedRaw string `json:"created"`
DiscNumber int64
DurationRaw int64 `json:"duration"`
Genre string
Parent int64
Path string
Size int64
Suffix string
Title string
Track int64
TranscodedContentType string
TranscodedSuffix string
Type string
Year int64
// Parsed values
Created time.Time
Duration time.Duration
}
Audio represents an audio item from Subsonic
type Client ¶
type Client struct {
Host string
Username string
Password string
// contains filtered or unexported fields
}
Client represents the required parameters to connect to a Subsonic server
func NewMock ¶
NewMock creates a new Client which receives mock data instead of connecting to a Subsonic server
func (Client) Download ¶
func (s Client) Download(id int64) (io.ReadCloser, error)
Download returns a io.ReadCloser which contains a raw, non-transcoded media file stream
func (Client) GetCoverArt ¶
GetCoverArt returns a io.ReadCloser which contains a cover art stream, scaled to the specified size
func (Client) GetIndexes ¶
GetIndexes returns an indexed structure of all artists from Subsonic
func (Client) GetLicense ¶
GetLicense retrieves details about the Subsonic server license
func (Client) GetMusicDirectory ¶
GetMusicDirectory returns a list of all content in a music directory
func (Client) GetMusicFolders ¶
func (s Client) GetMusicFolders() ([]MusicFolder, error)
GetMusicFolders returns the configured top-level music folders
func (Client) GetNowPlaying ¶
func (s Client) GetNowPlaying() ([]NowPlaying, error)
GetNowPlaying returns a list of tracks which are currently being played
func (Client) Scrobble ¶
Scrobble triggers a "Now Playing" or "Submission" request to Last.fm, if configured
func (Client) Stream ¶
func (s Client) Stream(id int64, options *StreamOptions) (io.ReadCloser, error)
Stream returns a io.ReadCloser which contains a processed media file stream, with an optional StreamOptions struct
type Content ¶
Content is a container used to contain the Directory, Audio, and Video structs residing in this Directory
type Directory ¶
type Directory struct {
// Raw values
ID int64
Album string
Artist string
CoverArt int64
CreatedRaw string `json:"created"`
Parent int64
Title string
// Parsed values
Created time.Time
}
Directory represents a media directory from Subsonic
type Index ¶
type Index struct {
// Raw values
Name string
ArtistRaw interface{} `json:"artist"`
// Artist - generated from raw interfaces
Artist []IndexArtist
}
Index represents a group in the Subsonic index
type IndexArtist ¶
IndexArtist represents an artist in the Subsonic index
type License ¶
type License struct {
// Raw values
DateRaw string `json:"date"`
Email string
Key string
Valid bool
// Parsed values
Date time.Time
}
License represents the license status of Subsonic
type MusicFolder ¶
MusicFolder represents a top-level music folders of Subsonic
type NowPlaying ¶
type NowPlaying struct {
// Raw values
ID int64
Album string
AlbumID int64
Artist string
ArtistID int64
BitRate int64
ContentType string
CoverArt int64
CreatedRaw string `json:"created"`
DiscNumber int64
DurationRaw int64
Genre string
IsDir bool
IsVideo bool
MinutesAgo int64
Parent int64
Path string
PlayerID int64
Size int64
Suffix string
Title string
Track int64
Username string
Year int64
// Parsed values
Created time.Time
Duration time.Duration
}
NowPlaying represents a now playing entry from Subsonic
type StreamOptions ¶
type StreamOptions struct {
MaxBitRate int64
Format string
TimeOffset int64
Size string
EstimateContentLength bool
}
StreamOptions represents additional options for the Stream() method
type Video ¶
type Video struct {
// Raw values
ID int64
BitRate int64
ContentType string
CoverArt int64
CreatedRaw string `json:"created"`
DurationRaw int64 `json:"duration"`
Parent int64
Path string
Size int64
Suffix string
Title string
TranscodedContentType string
TranscodedSuffix string
// Parsed values
Created time.Time
Duration time.Duration
}
Video represents a video item from Subsonic
