subsonic

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: GPL-3.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CredentialKey is the database key for the credential structure.
	CredentialKey = []byte("subsonicCredsKey")
	// ErrAuthenticationFailed is returned if authentication with the server failed.
	ErrAuthenticationFailed = errors.New("authentication failed")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Credentials
	// contains filtered or unexported fields
}

Client is the Subsonic client which talks to the Subsonic server.

func Login added in v0.8.0

func Login(username, password, host string) (*Client, error)

func New

func New(db jamsonic.AuthStore, credRequester jamsonic.CredentialRequester, logger *jamsonic.Logger) (*Client, error)

New returns a new instance of the Subsonic client. If credentials are stored in the storage, the client will use the stored credentials. Otherwise, it will request the user to enter the server url, username, and password on the command line.

func (*Client) FetchLibrary

func (c *Client) FetchLibrary() ([]*jamsonic.Artist, error)

FetchLibrary gets the library from the server. Library structure:

Artist1{
	Album1{
		Track1, Track2,...
	},
	Album2{...}
}
Artist2{...}

func (*Client) GetProvider

func (c *Client) GetProvider() jamsonic.MusicProvider

GetProvider returns the provider identifier.

func (*Client) GetStream

func (c *Client) GetStream(songID string) (io.ReadCloser, error)

GetStream returns a ReadCloser stream of the track. The audio is encoded as a MP3.

func (*Client) GetTrackInfo

func (c *Client) GetTrackInfo(trackID string) (*jamsonic.Track, error)

GetTrackInfo is an old API and is not implemented for this provider.

func (*Client) Host

func (c *Client) Host() string

Host returns the server host.

func (*Client) ListPlaylistEntries

func (c *Client) ListPlaylistEntries() ([]*jamsonic.PlaylistEntry, error)

ListPlaylistEntries is an old API and is not implemented for this provider.

func (*Client) ListPlaylists

func (c *Client) ListPlaylists() ([]*jamsonic.Playlist, error)

ListPlaylists should return the playlists. Currently this feature is not implemented for this provider.

func (*Client) ListTracks

func (c *Client) ListTracks() ([]*jamsonic.Track, error)

ListTracks is an old API and is not implemeted for this provider. Instead, FetchLibrary should be used.

type Credentials added in v0.8.0

type Credentials struct {
	// Username for the account.
	Username string
	// Authentication token.
	Token string
	// Salt for the authentication token.
	Salt string
	// Host is the URL to the server.
	Host string
}

Credentials is structure for subsonic credentials.

Jump to

Keyboard shortcuts

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