Documentation
¶
Index ¶
- Constants
- type Album
- type Artist
- type Connection
- func (connection *Connection) AddSongToPlaylist(playlistId string, songId string) error
- func (s *Connection) ClearCache()
- func (connection *Connection) CreatePlaylist(id, name string, songIds []string) (Playlist, error)
- func (connection *Connection) DeletePlaylist(id string) error
- func (connection *Connection) GetAlbum(id string) (Album, error)
- func (connection *Connection) GetArtist(id string) (Artist, error)
- func (connection *Connection) GetArtists() (Indexes, error)
- func (connection *Connection) GetCoverArt(id string) (image.Image, error)
- func (connection *Connection) GetGenres() ([]GenreEntry, error)
- func (connection *Connection) GetIndexes() (Indexes, error)
- func (connection *Connection) GetLyricsBySongId(id string) ([]StructuredLyrics, error)
- func (connection *Connection) GetMusicDirectory(id string) (Directory, error)
- func (connection *Connection) GetPlayUrl(entity Entity) string
- func (connection *Connection) GetPlaylist(id string) (Playlist, error)
- func (connection *Connection) GetPlaylists() (Playlists, error)
- func (connection *Connection) GetRandomSongs(id string) (Entities, error)
- func (connection *Connection) GetServerInfo() (Response, error)
- func (connection *Connection) GetSongsByGenre(genre string, offset int, musicFolderID string) (Entities, error)
- func (connection *Connection) GetStarred() (Results, error)
- func (connection *Connection) HasOpenSubsonicExtension(feature string) bool
- func (connection *Connection) LoadPlayQueue() (PlayQueue, error)
- func (s *Connection) RemoveAlbumCacheEntry(key string)
- func (s *Connection) RemoveArtistCacheEntry(key string)
- func (s *Connection) RemoveDirectoryCacheEntry(key string)
- func (connection *Connection) RemoveSongFromPlaylist(playlistId string, songIndex int) error
- func (connection *Connection) SavePlayQueue(queueIds []string, current string, position int) error
- func (connection *Connection) ScanStatus() (ScanStatus, error)
- func (connection *Connection) ScrobbleSubmission(id string, isSubmission bool) (Response, error)
- func (connection *Connection) Search(searchTerm string, artistOffset, albumOffset, songOffset int) (Results, error)
- func (s *Connection) SetClientInfo(name, version string)
- func (connection *Connection) StartScan() error
- func (connection *Connection) ToggleStar(id string, starredItems map[string]struct{}) (Response, error)
- type Directory
- type DiscTitle
- type Entities
- type Entity
- func (e Entity) GetAlbum() string
- func (e Entity) GetAlbumArtist() string
- func (e Entity) GetArtist() string
- func (e Entity) GetDiscNumber() int
- func (e Entity) GetDuration() int
- func (e Entity) GetGenre() string
- func (e Entity) GetId() string
- func (e Entity) GetSongTitle() string
- func (e Entity) GetTitle() string
- func (e Entity) GetTrackNumber() int
- func (e Entity) IsValid() bool
- type EntityBase
- type Error
- type Extension
- type Genre
- type GenreEntries
- type GenreEntry
- type Id
- type Ider
- type Index
- type Indexes
- type Info
- type LyricsLine
- type LyricsList
- type PlayQueue
- type Playlist
- type Playlists
- type ReplayGain
- type Response
- type Results
- type ScanStatus
- type Songs
- type StructuredLyrics
Constants ¶
const MAX_RANDOM_SONGS = 50
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct { EntityBase Name string `json:"name"` SongCount int `json:"songCount"` PlayCount int `json:"playCount"` Songs Entities `json:"song"` Genres []Genre `json:"genres"` // Compilation is available only from Navidrome Compilation bool `json:"isCompilation"` // SortName is available only from Navidrome SortName string // DiscTitles is available only from Navidrome DiscTitles []DiscTitle }
type Artist ¶
type Connection ¶
type Connection struct { Username string Password string Host string PlaintextAuth bool Scrobble bool RandomSongNumber uint // contains filtered or unexported fields }
func Init ¶
func Init(logger logger.LoggerInterface) *Connection
func (*Connection) AddSongToPlaylist ¶
func (connection *Connection) AddSongToPlaylist(playlistId string, songId string) error
func (*Connection) ClearCache ¶
func (s *Connection) ClearCache()
func (*Connection) CreatePlaylist ¶
func (connection *Connection) CreatePlaylist(id, name string, songIds []string) (Playlist, error)
CreatePlaylist creates or updates a playlist on the server. If id is provided, the existing playlist with that ID is updated with the new song list. If name is provided, a new playlist is created with the song list. Either id or name _must_ be populated, or the function returns an error. If _both_ id and name are poplated, the function returns an error. songIds may be nil, in which case the new playlist is created empty, or all songs are removed from the existing playlist.
func (*Connection) DeletePlaylist ¶
func (connection *Connection) DeletePlaylist(id string) error
func (*Connection) GetAlbum ¶
func (connection *Connection) GetAlbum(id string) (Album, error)
GetAlbum gets information about a specific album If the item is in the cache, the cached item is returned; if not, it is put in the cache and returned. The songs in the album are sorted before return. https://opensubsonic.netlify.app/docs/endpoints/getalbum/
func (*Connection) GetArtist ¶
func (connection *Connection) GetArtist(id string) (Artist, error)
GetArtist gets information about a single artist. If the item is in the cache, the cached item is returned; if not, it is put in the cache and returned. The albums in the response are sorted before return. https://opensubsonic.netlify.app/docs/endpoints/getartist/
func (*Connection) GetArtists ¶
func (connection *Connection) GetArtists() (Indexes, error)
GetIndexes returns an indexed structure of all artists Artists in the response are _not_ sorted https://opensubsonic.netlify.app/docs/endpoints/getartists/ TODO (B) Artists that only exist under Various Artists don't show up as their own artists in getArtists calls to either gonic or Navidrome. E.g. if an artist has a single song tagged with artist=X and albumartist=A, living in directory A/somealbum/song.opus, that artist will not appear in getArtists
func (*Connection) GetCoverArt ¶
func (connection *Connection) GetCoverArt(id string) (image.Image, error)
GetCoverArt fetches album art from the server, by ID. If id is empty, an error is returned. If, for some reason, the server response can't be parsed into an image, an error is returned. This function can process images of mime types - image/png - image/jpeg - image/gif These assets are not cached by this connection. https://opensubsonic.netlify.app/docs/endpoints/getcoverart/
func (*Connection) GetGenres ¶
func (connection *Connection) GetGenres() ([]GenreEntry, error)
func (*Connection) GetIndexes ¶
func (connection *Connection) GetIndexes() (Indexes, error)
GetIndexes returns an indexed structure of all artists https://opensubsonic.netlify.app/docs/endpoints/getindexes/
func (*Connection) GetLyricsBySongId ¶
func (connection *Connection) GetLyricsBySongId(id string) ([]StructuredLyrics, error)
GetLyricsBySongId fetches time synchronized song lyrics. If the server does not support this, an error is returned.
func (*Connection) GetMusicDirectory ¶
func (connection *Connection) GetMusicDirectory(id string) (Directory, error)
GetMusicDirector fetches a listing of all files in a music directory, by ID. If the item is in the cache, the cached item is returned; if not, it is put in the cache and returned. The entities in the directory are sorted before return. https://opensubsonic.netlify.app/docs/endpoints/getmusicdirectory/
func (*Connection) GetPlayUrl ¶
func (connection *Connection) GetPlayUrl(entity Entity) string
note that this function does not make a request, it just formats the play url to pass to mpv
func (*Connection) GetPlaylist ¶
func (connection *Connection) GetPlaylist(id string) (Playlist, error)
func (*Connection) GetPlaylists ¶
func (connection *Connection) GetPlaylists() (Playlists, error)
func (*Connection) GetRandomSongs ¶
func (connection *Connection) GetRandomSongs(id string) (Entities, error)
GetRandomSongs fetches a number of random songs. The results are not sorted. If a song Id is provided, songs similar to that song will be selected. The function returns Connection.RandomSongNumber or fewer songs; if it is 0, then MAX_RANDOM_SONGS are returned.
func (*Connection) GetServerInfo ¶
func (connection *Connection) GetServerInfo() (Response, error)
GetServerInfo pings the server and returns the response, which contains basic information about the server https://opensubsonic.netlify.app/docs/endpoints/ping/
func (*Connection) GetSongsByGenre ¶
func (*Connection) GetStarred ¶
func (connection *Connection) GetStarred() (Results, error)
func (*Connection) HasOpenSubsonicExtension ¶
func (connection *Connection) HasOpenSubsonicExtension(feature string) bool
func (*Connection) LoadPlayQueue ¶
func (connection *Connection) LoadPlayQueue() (PlayQueue, error)
func (*Connection) RemoveAlbumCacheEntry ¶
func (s *Connection) RemoveAlbumCacheEntry(key string)
func (*Connection) RemoveArtistCacheEntry ¶
func (s *Connection) RemoveArtistCacheEntry(key string)
func (*Connection) RemoveDirectoryCacheEntry ¶
func (s *Connection) RemoveDirectoryCacheEntry(key string)
func (*Connection) RemoveSongFromPlaylist ¶
func (connection *Connection) RemoveSongFromPlaylist(playlistId string, songIndex int) error
func (*Connection) SavePlayQueue ¶
func (connection *Connection) SavePlayQueue(queueIds []string, current string, position int) error
func (*Connection) ScanStatus ¶
func (connection *Connection) ScanStatus() (ScanStatus, error)
ScanStatus returns the state of any current scanning processes. https://opensubsonic.netlify.app/docs/endpoints/getscanstatus/
func (*Connection) ScrobbleSubmission ¶
func (connection *Connection) ScrobbleSubmission(id string, isSubmission bool) (Response, error)
func (*Connection) Search ¶
func (connection *Connection) Search(searchTerm string, artistOffset, albumOffset, songOffset int) (Results, error)
Search uses the Subsonic search3 API to query a server for all songs that have ID3 tags that match the query. The query is global, in that it matches in any ID3 field. https://www.subsonic.org/pages/api.jsp#search3
func (*Connection) SetClientInfo ¶
func (s *Connection) SetClientInfo(name, version string)
func (*Connection) StartScan ¶
func (connection *Connection) StartScan() error
StartScan tells the Subsonic server to initiate a media library scan. Whether this is a deep or surface scan is dependent on the server implementation. https://opensubsonic.netlify.app/docs/endpoints/startscan/
func (*Connection) ToggleStar ¶
func (connection *Connection) ToggleStar(id string, starredItems map[string]struct{}) (Response, error)
type Directory ¶
type Entities ¶
type Entities []Entity
Entities is a sortable list of entities. Directories are first, then in alphabelical order. Entities are sorted by track number, if they have track numbers; otherwise, they're sorted alphabetically.
type Entity ¶
type Entity struct { EntityBase Parent string Path string AlbumId string AlbumArtists []Artist DisplayAlbumArtist string BitRate int BitDepth int SamplingRate int ChannelCount int ContentType string IsDirectory bool `json:"isDir"` IsVideo bool Size int Suffix string Track int DiscNumber int Type string ReplayGain ReplayGain }
Entity could be either a song or a directory, because that's how Subsonic rolls.
func (Entity) GetAlbumArtist ¶
func (Entity) GetDiscNumber ¶
func (Entity) GetDuration ¶
func (Entity) GetId ¶
##################################### Methods allowing Entity to implement remote.TrackInterface #####################################
func (Entity) GetSongTitle ¶
Return the title if present, otherwise fallback to the file path
func (Entity) GetTrackNumber ¶
type EntityBase ¶
type EntityBase struct { Id string Created string ArtistId string Artist string DisplayArtist string Album string Duration int Genre string Year int CoverArtId string `json:"coverArt"` // Title is only available for Albums from gonic Title string // Artists is only available for Entities from gonic Artists []Artist // MusicBrainzId is only available for Albums from Navidrome MusicBrainzId string }
type GenreEntries ¶
type GenreEntries struct {
Genres []GenreEntry `json:"genre"`
}
type GenreEntry ¶
type LyricsLine ¶
type LyricsList ¶
type LyricsList struct {
StructuredLyrics []StructuredLyrics `json:"structuredLyrics"`
}
type ReplayGain ¶
type Response ¶
type Response struct { Status string Version string Type string ServerVersion string OpenSubsonic bool // There's no better way to do this, because Go generics are useless RandomSongs Songs SimilarSongs Songs Starred Results SearchResult3 Results Directory Directory Album Album Artists Indexes Artist Artist ScanStatus ScanStatus PlayQueue PlayQueue Genres GenreEntries SongsByGenre Songs Indexes Indexes LyricsList LyricsList Playlists Playlists Playlist Playlist OpenSubsonicExtensions []Extension Error Error }
type ScanStatus ¶
type Songs ¶
type Songs struct {
Songs Entities `json:"song"`
}
Songs (and Playlists) are here because of how the Subsonic API structures the JSON, frequently nesting things unnecessarily.
type StructuredLyrics ¶
type StructuredLyrics struct { Lang string `json:"lang"` Synced bool `json:"synced"` Lines []LyricsLine `json:"line"` }