mediaprovider

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID          string
	CoverArtID  string
	Name        string
	Duration    int
	ArtistIDs   []string
	ArtistNames []string
	Year        int
	Genres      []string
	TrackCount  int
	Favorite    bool
}

type AlbumFilter

type AlbumFilter struct {
	MinYear int
	MaxYear int      // 0 == unset/match any
	Genres  []string // len(0) == unset/match any

	ExcludeFavorited   bool // mut. exc. with ExcludeUnfavorited
	ExcludeUnfavorited bool // mut. exc. with ExcludeFavorited
}

func (AlbumFilter) IsNil added in v0.8.0

func (a AlbumFilter) IsNil() bool

Returns true if the filter is the nil filter - i.e. matches everything

func (AlbumFilter) Matches added in v0.8.0

func (f AlbumFilter) Matches(album *Album) bool

type AlbumInfo added in v0.5.0

type AlbumInfo struct {
	Notes         string
	LastFmUrl     string
	MusicBrainzID string
}

type AlbumIterator

type AlbumIterator interface {
	Next() *Album
}

type AlbumWithTracks

type AlbumWithTracks struct {
	Album
	Tracks []*Track
}

type Artist

type Artist struct {
	ID         string
	CoverArtID string
	Name       string
	Favorite   bool
	AlbumCount int
}

type ArtistInfo

type ArtistInfo struct {
	Biography      string
	LastFMUrl      string
	ImageURL       string
	SimilarArtists []*Artist
}

type ArtistWithAlbums

type ArtistWithAlbums struct {
	Artist
	Albums []*Album
}

type ContentType added in v0.7.0

type ContentType int
const (
	ContentTypeAlbum ContentType = iota
	ContentTypeArtist
	ContentTypePlaylist
	ContentTypeTrack
	ContentTypeGenre
)

func (ContentType) String added in v0.7.0

func (c ContentType) String() string

type Favorites

type Favorites struct {
	Albums  []*Album
	Artists []*Artist
	Tracks  []*Track
}

type Genre

type Genre struct {
	Name       string
	AlbumCount int
	TrackCount int
}

type LoginResponse added in v0.8.0

type LoginResponse struct {
	Error       error
	IsAuthError bool
}

type MediaProvider

type MediaProvider interface {
	SetPrefetchCoverCallback(cb func(coverArtID string))

	GetTrack(trackID string) (*Track, error)

	GetAlbum(albumID string) (*AlbumWithTracks, error)

	GetAlbumInfo(albumID string) (*AlbumInfo, error)

	GetArtist(artistID string) (*ArtistWithAlbums, error)

	GetArtistInfo(artistID string) (*ArtistInfo, error)

	GetPlaylist(playlistID string) (*PlaylistWithTracks, error)

	GetCoverArt(coverArtID string, size int) (image.Image, error)

	AlbumSortOrders() []string

	IterateAlbums(sortOrder string, filter AlbumFilter) AlbumIterator

	IterateTracks(searchQuery string) TrackIterator

	SearchAlbums(searchQuery string, filter AlbumFilter) AlbumIterator

	SearchAll(searchQuery string, maxResults int) ([]*SearchResult, error)

	GetRandomTracks(genre string, count int) ([]*Track, error)

	GetSimilarTracks(artistID string, count int) ([]*Track, error)

	GetArtists() ([]*Artist, error)

	GetGenres() ([]*Genre, error)

	GetFavorites() (Favorites, error)

	GetStreamURL(trackID string, forceRaw bool) (string, error)

	GetTopTracks(artist Artist, count int) ([]*Track, error)

	SetFavorite(params RatingFavoriteParameters, favorite bool) error

	GetPlaylists() ([]*Playlist, error)

	CreatePlaylist(name string, trackIDs []string) error

	CanMakePublicPlaylist() bool

	EditPlaylist(id, name, description string, public bool) error

	AddPlaylistTracks(id string, trackIDsToAdd []string) error

	RemovePlaylistTracks(id string, trackIdxsToRemove []int) error

	ReplacePlaylistTracks(id string, trackIDs []string) error

	DeletePlaylist(id string) error

	// True if the `submission` parameter to TrackEndedPlayback will be respected
	// If false, the begin playback scrobble registers a play count immediately
	// when TrackBeganPlayback is invoked.
	ClientDecidesScrobble() bool

	TrackBeganPlayback(trackID string) error

	TrackEndedPlayback(trackID string, positionSecs int, submission bool) error

	DownloadTrack(trackID string) (io.Reader, error)

	RescanLibrary() error
}

type Playlist

type Playlist struct {
	ID          string
	CoverArtID  string
	Name        string
	Description string
	Public      bool
	Owner       string
	Duration    int
	TrackCount  int
}

type PlaylistWithTracks

type PlaylistWithTracks struct {
	Playlist
	Tracks []*Track
}

type RatingFavoriteParameters

type RatingFavoriteParameters struct {
	AlbumIDs  []string
	ArtistIDs []string
	TrackIDs  []string
}

type SearchResult added in v0.7.0

type SearchResult struct {
	Name    string
	ID      string
	CoverID string
	Type    ContentType

	// for Album / Playlist: track count
	//     Artist / Genre: album count
	//     Track: length (seconds)
	Size int

	// Unset for ContentTypes Artist, Playlist, and Genre
	ArtistName string
}

type Server added in v0.8.0

type Server interface {
	Login(username, password string) LoginResponse
	MediaProvider() MediaProvider
}

type SupportsRating added in v0.8.0

type SupportsRating interface {
	SetRating(params RatingFavoriteParameters, rating int) error
}

type Track

type Track struct {
	ID          string
	CoverArtID  string
	ParentID    string
	Name        string
	Duration    int
	TrackNumber int
	DiscNumber  int
	Genre       string
	ArtistIDs   []string
	ArtistNames []string
	Album       string
	AlbumID     string
	Year        int
	Rating      int
	Favorite    bool
	Size        int64
	PlayCount   int
	FilePath    string
	BitRate     int
}

type TrackIterator

type TrackIterator interface {
	Next() *Track
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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