Documentation ¶
Overview ¶
Package player contains all logic for jellycli. This includes queue (history) management, low-level audio and audio controls.
Index ¶
- type Audio
- func (a *Audio) AddStatusCallback(cb func(status interfaces.AudioStatus))
- func (a *Audio) Continue()
- func (a *Audio) Next()
- func (a *Audio) Pause()
- func (a *Audio) PlayPause()
- func (a *Audio) Previous()
- func (a *Audio) Seek(ticks interfaces.AudioTick)
- func (a *Audio) SetMute(muted bool)
- func (a *Audio) SetShuffle(shuffle bool)
- func (a *Audio) SetVolume(volume interfaces.AudioVolume)
- func (a *Audio) StopMedia()
- func (a *Audio) ToggleMute()
- type Items
- func (i *Items) GetAlbumArtist(album *models.Album) (*models.Artist, error)
- func (i *Items) GetAlbumArtists(paging interfaces.Paging) ([]*models.Artist, int, error)
- func (i *Items) GetAlbumSongs(album models.Id) ([]*models.Song, error)
- func (i *Items) GetAlbums(opts *interfaces.QueryOpts) ([]*models.Album, int, error)
- func (i *Items) GetArtistAlbums(artist models.Id) ([]*models.Album, error)
- func (i *Items) GetArtists(opts *interfaces.QueryOpts) ([]*models.Artist, int, error)
- func (i *Items) GetFavoriteAlbums(paging interfaces.Paging) ([]*models.Album, int, error)
- func (i *Items) GetFavoriteArtists() ([]*models.Artist, error)
- func (i *Items) GetGenreAlbums(genre models.IdName) ([]*models.Album, error)
- func (i *Items) GetGenres(paging interfaces.Paging) ([]*models.IdName, int, error)
- func (i *Items) GetInstantMix(item models.Item) ([]*models.Song, error)
- func (i *Items) GetLatestAlbums() ([]*models.Album, error)
- func (i *Items) GetLink(item models.Item) string
- func (i *Items) GetPlaylistSongs(playlist *models.Playlist) error
- func (i *Items) GetPlaylists() ([]*models.Playlist, error)
- func (i *Items) GetRecentlyPlayed(paging interfaces.Paging) ([]*models.Song, int, error)
- func (i *Items) GetSimilarAlbums(album models.Id) ([]*models.Album, error)
- func (i *Items) GetSimilarArtists(artist models.Id) ([]*models.Artist, error)
- func (i *Items) GetSongArtistAlbum(song *models.Song) (*models.Album, *models.Artist, error)
- func (i *Items) GetSongs(page, pageSize int) ([]*models.Song, int, error)
- func (i *Items) GetStatistics() models.Stats
- func (i *Items) Search(itemType models.ItemType, query string) ([]models.Item, error)
- func (i *Items) UpdateLocalAlbums(limit int) error
- func (i *Items) UpdateLocalArtists(limit int) error
- func (i *Items) UpdateLocalSongs(limit int) error
- func (i *Items) UpdatePlaylists() error
- type Player
- type Queue
- func (q *Queue) AddQueueChangedCallback(cb func(content []*models.Song))
- func (q *Queue) AddSongs(songs []*models.Song)
- func (q *Queue) ClearQueue(first bool)
- func (q *Queue) GetHistory(n int) []*models.Song
- func (q *Queue) GetQueue() []*models.Song
- func (q *Queue) PlayNext(songs []*models.Song)
- func (q *Queue) RemoveSong(index int)
- func (q *Queue) Reorder(index int, down bool) bool
- func (q *Queue) SetHistoryChangedCallback(cb func([]*models.Song))
- func (q *Queue) SetShuffle(enabled bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audio ¶ added in v0.3.0
type Audio struct {
// contains filtered or unexported fields
}
Audio manages playing song and implements interfaces.Player
func (*Audio) AddStatusCallback ¶ added in v0.3.0
func (a *Audio) AddStatusCallback(cb func(status interfaces.AudioStatus))
AddStatusCallback adds a callback that gets called every time audio status is changed, or after certain time.
func (*Audio) Continue ¶ added in v0.3.0
func (a *Audio) Continue()
Continue continues paused audio. If audio is already playing, do nothing.
func (*Audio) Next ¶ added in v0.3.0
func (a *Audio) Next()
Next plays next track. If there's no next song to play, do nothing.
func (*Audio) Pause ¶ added in v0.3.0
func (a *Audio) Pause()
Pause pauses audio. If audio is already paused, do nothing.
func (*Audio) Previous ¶ added in v0.3.0
func (a *Audio) Previous()
Previous plays previous track. If previous track does not exist, do nothing.
func (*Audio) Seek ¶ added in v0.3.0
func (a *Audio) Seek(ticks interfaces.AudioTick)
Seek seeks given ticks. If there is no audio, do nothing.
func (*Audio) SetShuffle ¶ added in v0.9.0
func (*Audio) SetVolume ¶ added in v0.3.0
func (a *Audio) SetVolume(volume interfaces.AudioVolume)
SetVolume sets volume to given level.
func (*Audio) StopMedia ¶ added in v0.3.0
func (a *Audio) StopMedia()
StopMedia stops music. If there is no audio to play, do nothing.
func (*Audio) ToggleMute ¶ added in v0.9.0
func (a *Audio) ToggleMute()
type Items ¶ added in v0.3.0
type Items struct {
// contains filtered or unexported fields
}
Items implements interfaces.ItemController
func (*Items) GetAlbumArtist ¶ added in v0.5.0
func (*Items) GetAlbumArtists ¶ added in v0.3.0
func (*Items) GetAlbumSongs ¶ added in v0.3.0
func (*Items) GetArtistAlbums ¶ added in v0.3.0
func (*Items) GetArtists ¶ added in v0.3.0
func (*Items) GetFavoriteAlbums ¶ added in v0.3.0
func (*Items) GetFavoriteArtists ¶ added in v0.3.0
func (*Items) GetGenreAlbums ¶ added in v0.4.0
func (*Items) GetInstantMix ¶ added in v0.5.0
func (*Items) GetLatestAlbums ¶ added in v0.3.0
func (*Items) GetPlaylistSongs ¶ added in v0.3.0
func (*Items) GetPlaylists ¶ added in v0.3.0
func (*Items) GetRecentlyPlayed ¶ added in v0.5.0
func (*Items) GetSimilarAlbums ¶ added in v0.4.0
func (*Items) GetSimilarArtists ¶ added in v0.4.0
func (*Items) GetSongArtistAlbum ¶ added in v0.5.0
func (*Items) GetStatistics ¶ added in v0.3.0
func (*Items) UpdateLocalAlbums ¶ added in v0.9.0
UpdateLocalAlbums pulls latest info on albums from server and stores/updates on local database.
func (*Items) UpdateLocalArtists ¶ added in v0.9.0
UpdateLocalArtists pulls latest info on artists from server and stores/updates on local database.
func (*Items) UpdateLocalSongs ¶ added in v0.9.0
func (*Items) UpdatePlaylists ¶ added in v0.9.0
type Player ¶
Player wraps all controllers and implements interfaces.QueueController, interfaces.Player and interfaces.ItemController.
func NewPlayer ¶
func NewPlayer(browser api.MediaServer) (*Player, error)
initialize new player. This also initializes faiface.Speaker, which should be initialized only once.
func (*Player) Next ¶ added in v0.3.0
func (p *Player) Next()
Next plays next song from queue. Override Audio next to ensure there is track to play and download it
func (*Player) Previous ¶ added in v0.3.0
func (p *Player) Previous()
Previous plays previous track. Override Audio previous to ensure there is track to play and download it
func (*Player) SetShuffle ¶ added in v0.9.0
type Queue ¶ added in v0.3.0
type Queue struct {
// contains filtered or unexported fields
}
Queue implements interfaces.QueueController
func (*Queue) AddQueueChangedCallback ¶ added in v0.3.0
AddQueueChangedCallback adds function that is called every time queue changes.
func (*Queue) AddSongs ¶ added in v0.3.0
AddSongs adds songs to the end of queue. Adding songs calls QueueChangedCallback.
func (*Queue) ClearQueue ¶ added in v0.3.0
ClearQueue clears queue. This also calls QueueChangedCallback.
func (*Queue) GetHistory ¶ added in v0.3.0
GetHistory get's n past songs that has been played.
func (*Queue) GetQueue ¶ added in v0.3.0
GetQueue gets currently ongoing queue of items with complete info for each song.
func (*Queue) RemoveSong ¶ added in v0.4.0
func (*Queue) Reorder ¶ added in v0.3.0
Reorder sets item in index currentIndex to newIndex. If either currentIndex or NewIndex is not valid, do nothing. On successful order QueueChangedCallback gets called.
func (*Queue) SetHistoryChangedCallback ¶ added in v0.3.0
SetHistoryChangedCallback sets a function that gets called every time history items update.