player

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlayback

func NewPlayback(client SpotifyClient, playerStateChanges chan *web.WebPlaybackState, webPlayerID spotify.ID) currentlyPlaying

NewPlayback creates data structure representing current spotify playback.

func NewSearchResults

func NewSearchResults(client SpotifyClient, name string) searchResultsInterface

func StartRemoteAuthentication

func StartRemoteAuthentication(authenticator web.SpotifyAuthenticatorInterface, state string) error

StartRemoteAuthentication redirects to spotify's API in order to authenticate user

Types

type AlbumList

type AlbumList struct {
	Table *tui.Table
	// contains filtered or unexported fields
}

AlbumList represents list of albums with underlying data, table to display, box in which table is places, indexes pointing to currently playing item, and last chosen items.

type DebugClient

type DebugClient struct {
	Player
	Searcher
	UserAlbumFetcher
}

DebugClient is a dummy struct used when running in debug mode

func (DebugClient) CurrentUser

func (fc DebugClient) CurrentUser() (*spotify.PrivateUser, error)

CurrentUser is a dummy implementation used when running in debug mode

func (DebugClient) Next

func (fc DebugClient) Next() error

Next is a dummy implementation used when running in debug mode

func (DebugClient) Pause

func (fc DebugClient) Pause() error

Pause is a dummy implementation used when running in debug mode

func (DebugClient) PlayerCurrentlyPlaying

func (fc DebugClient) PlayerCurrentlyPlaying() (*spotify.CurrentlyPlaying, error)

PlayerCurrentlyPlaying is a dummy implementation used when running in debug mode

func (DebugClient) PlayerDevices

func (fc DebugClient) PlayerDevices() ([]spotify.PlayerDevice, error)

PlayerDevices is a dummy implementation used when running in debug mode

func (DebugClient) Previous

func (fc DebugClient) Previous() error

Previous is a dummy implementation used when running in debug mode

func (DebugClient) Token

func (fc DebugClient) Token() (*oauth2.Token, error)

Token is a dummy implementation used when running in debug mode

func (DebugClient) TransferPlayback

func (fc DebugClient) TransferPlayback(id spotify.ID, play bool) error

TransferPlayback is a dummy implementation used when running in debug mode

type DebugPlayer

type DebugPlayer struct {
}

func (DebugPlayer) Play

func (dp DebugPlayer) Play() error

Play is a dummy implementation used when running in debug mode

func (DebugPlayer) PlayOpt

func (dp DebugPlayer) PlayOpt(opt *spotify.PlayOptions) error

PlayOpt is a dummy implementation used when running in debug mode

type DebugSearcher

type DebugSearcher struct{}

func (DebugSearcher) Search

Search is a dummy implementation used when running in debug mode

type DebugUserAlbumFetcher

type DebugUserAlbumFetcher struct{}

func (DebugUserAlbumFetcher) CurrentUsersAlbumsOpt

func (debugFetcher DebugUserAlbumFetcher) CurrentUsersAlbumsOpt(options *spotify.Options) (*spotify.SavedAlbumPage, error)

CurrentUsersAlbumsOpt is a dummy implementation used when running in debug mode

type DevicesTable

type DevicesTable struct {
	Table *tui.Table
	// contains filtered or unexported fields
}

type Playback

type Playback struct {
	Previous *tui.Button
	Next     *tui.Button
	Stop     *tui.Button
	Play     *tui.Button
	Box      *tui.Box
}

type Player

type Player interface {
	Play() error
	PlayOpt(opt *spotify.PlayOptions) error
}
type Search struct {
	Focusables []tui.Widget
	Box        *tui.Box
}

func NewSearch

func NewSearch(client SpotifyClient) *Search

NewSearch creates data structure which represent search input with search results.

type Searcher

type Searcher interface {
	Search(string, spotify.SearchType) (*spotify.SearchResult, error)
}
type SideBar struct {
	AlbumList *AlbumList
	Box       *tui.Box
}

SideBar represents box with album list inside this box.

func NewSideBar

func NewSideBar(client SpotifyClient) (*SideBar, error)

NewSideBar creates struct which holds references to SideBar Box and AlbumList placed inside SideBar

type SpotifyClient

type SpotifyClient interface {
	UserAlbumFetcher
	Player
	Searcher
	Pause() error
	Previous() error
	Next() error
	PlayerCurrentlyPlaying() (*spotify.CurrentlyPlaying, error)
	PlayerDevices() ([]spotify.PlayerDevice, error)
	TransferPlayback(spotify.ID, bool) error
}

SpotifyClient is a wrapper interface around spotify.client used in order to improve testability of the code.

func NewDebugClient

func NewDebugClient() SpotifyClient

NewDebugClient returns Client which can be used in debug mode or in tests, It does not communicate with Spotify API.

type URIName

type URIName struct {
	URI  spotify.URI
	Name string
}

type UserAlbumFetcher

type UserAlbumFetcher interface {
	CurrentUsersAlbumsOpt(opt *spotify.Options) (*spotify.SavedAlbumPage, error)
}

Jump to

Keyboard shortcuts

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