streamingproviders

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: LGPL-3.0 Imports: 2 Imported by: 0

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
}

Info is a struct containing information about a provider. All providers must return this in it's

type NewProvider

type NewProvider func(ctx context.Context) (Provider, error)

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 string) (*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
}

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.

Jump to

Keyboard shortcuts

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