Documentation
¶
Overview ¶
Package streamingproviders implements a generic interface and types for interacting with various Music streaming providers. Primarily geared towards getting song information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { // Identifier is the unique identifier for this provider. It should // not be used for display purposes. Identifier string // Name is a user friendly name of the provider. It should not be used // for unique identification. Name string // Emoji is the emoji used for this provider. Emoji discordgo.ComponentEmoji // URLHostname is the hostname of the provider's website. This is used // to determine if the provider should be used when a link is posted. // If not set, then the provider will be provided all URLs and the // provider should abort if it cannot handle the URL. URLHostname string }
Info is a struct containing information about a provider. All providers must return this in it's
type NewProvider ¶
NewProvider is a function that returns a new Provider. If a provider is unable to be used (e.g., no authentication) it should return an error. Callers should handle the error and only fail if that provider is required, otherwise consider it disabled.
type Provider ¶
type Provider interface { // Info returns information about this provider. Info() Info // LookupSongByURL returns a song from the provided URL. LookupSongByURL(ctx context.Context, url *url.URL) (*Song, error) // Search returns a song from this provider using a Song provided from // another provider. Search(ctx context.Context, song *Song) (*Song, error) }
Provider is a streaming provider interface capable of looking up songs by URLs or search queries and returning information about them.
type Song ¶
type Song struct { // Provider is the name of the provider that returned this song. Provider Info // ProviderURL is the URL of the song on the provider's website. This // should be publicly accessible. ProviderURL string // ISRC is the international standard recording code for the song. // This is used to uniquely identify a song. ISRC string // Title is the title of the song. Title string // Artists is the list of artists on the song. The first artist is // considered the primary artist. Artists []string // Album is the album of the song. Album string // AlbumArtURL is the URL of the album art for the song. This must be // publicly accessible. AlbumArtURL string // Duration is the duration of the song in seconds. Duration int }
Song is a music track.
Directories
¶
Path | Synopsis |
---|---|
Package applemusic implements a streamingproviders.Provider for the Apple Music streaming service.
|
Package applemusic implements a streamingproviders.Provider for the Apple Music streaming service. |
Package spotify implements a streamingprovider for Spotify.
|
Package spotify implements a streamingprovider for Spotify. |
Package tidal implements a streamingprovider for TIDAL.
|
Package tidal implements a streamingprovider for TIDAL. |