Documentation ¶
Overview ¶
Handles hashing Taken from stmps https://github.com/spezifisch/stmps
Handles listings of artists and albums ¶
Main request API calls for interacting with Subsonic Loosely based on stmps https://github.com/spezifisch/stmps
Handles responses and their json structs
Index ¶
- func FormatAlbums(albums []Album, color bool, interactive bool) string
- func FormatArtists(artists []Artist, color bool, interactive bool) string
- func FormatSongs(songs []Song, color bool, interactive bool) string
- type Album
- type Artist
- type Artists
- type Formatter
- type Index
- type Response
- type Song
- type SubsonicConnection
- func (c *SubsonicConnection) GetAlbum(id string, sync bool, displayRaw bool, quiet bool, color bool, ...) (string, error)
- func (c *SubsonicConnection) GetArtist(id string, sync bool, displayRaw bool, quiet bool, color bool, ...) (string, error)
- func (c *SubsonicConnection) GetArtists(sync bool, displayRaw bool, quiet bool, color bool, interactive bool) (string, error)
- func (c *SubsonicConnection) GetSongIds(id string) ([]string, error)
- func (c *SubsonicConnection) GetSongUrls(id string) ([]string, error)
- func (c *SubsonicConnection) Scrobble(id string) (err error)
- type SubsonicResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Album ¶
type Album struct { // Prefix should be `al-` ID string `json:"id"` // Parent artist Parent string `json:"artistId"` // UTF-8 name Name string `json:"name"` Genre string `json:"genre"` Songs []Song `json:"song"` Year int `json:"year"` SongCount int `json:"songCount"` // In seconds Duration int `json:"duration"` }
type Artists ¶
type Artists struct { IgnoredArticles string `json:"ignoredArticles"` Index []Index `json:"index"` }
func (*Artists) ExtractArtists ¶
Remove character indexing and get all artists
type Response ¶
type Response struct {
SubsonicResponse SubsonicResponse `json:"subsonic-response"`
}
type Song ¶
type Song struct { // Prefix should be `tr-` ID string `json:"id"` // flac/mp3 etc. Suffix string `json:"suffix"` // Main song title Title string `json:"title"` // Parent album Parent string `json:"parent"` // Should be music Type string `json:"type"` Track int `json:"track"` DiscNumber int `json:"discNumber"` BitRate int `json:"bitRate"` // In seconds Duration int `json:"duration"` // In bytes Size int `json:"size"` // Important to know we can stream this IsDir bool `json:"isDir"` }
type SubsonicConnection ¶
func (*SubsonicConnection) GetAlbum ¶
func (c *SubsonicConnection) GetAlbum( id string, sync bool, displayRaw bool, quiet bool, color bool, interactive bool, ) (string, error)
Get songs from an album https://www.subsonic.org/pages/api.jsp#getAlbum
The id string should have an `al-` prefix ¶
Always cache, set TTL 1 week. Force refetch with --sync
func (*SubsonicConnection) GetArtist ¶
func (c *SubsonicConnection) GetArtist( id string, sync bool, displayRaw bool, quiet bool, color bool, interactive bool, ) (string, error)
Get albums from an artist https://www.subsonic.org/pages/api.jsp#getArtist
The id string should have an `ar-` prefix ¶
Always cache, set TTL 1 week. Force refetch with --sync
func (*SubsonicConnection) GetArtists ¶
func (c *SubsonicConnection) GetArtists( sync bool, displayRaw bool, quiet bool, color bool, interactive bool, ) (string, error)
Get all artists, similar to indexes https://www.subsonic.org/pages/api.jsp#getArtists
Always cache, set TTL 1 week. Force refetch with --sync
func (*SubsonicConnection) GetSongIds ¶
func (c *SubsonicConnection) GetSongIds(id string) ([]string, error)
Given id, get song ids if album, else just return the id if track
func (*SubsonicConnection) GetSongUrls ¶
func (c *SubsonicConnection) GetSongUrls(id string) ([]string, error)
Given ID, get song url If album, we have to parse it Else if just a track, return the track id as part of the url
func (*SubsonicConnection) Scrobble ¶
func (c *SubsonicConnection) Scrobble(id string) (err error)
Scrobble a submission, where the id is a track id https://www.subsonic.org/pages/api.jsp#scrobble
type SubsonicResponse ¶
type SubsonicResponse struct { // Should returns "ok" Status string `json:"status"` // Should return server version Version string `json:"version"` // Should return server name, e.g. "gonic" Type string `json:"type"` // Should return subsonic API version ServerVersion string `json:"serverVersion"` // Relevant for GetArtists() Artists Artists `json:"artists,omitempty"` // Relevant for GetArtist() Artist Artist `json:"artist,omitempty"` // Relevant for GetAlbum() Album Album `json:"album,omitempty"` // Should return true OpenSubsonic bool `json:"openSubsonic"` }