Documentation ¶
Index ¶
- Constants
- Variables
- func GetSpotifyAlbumImage(album *spotify.SimpleAlbum) (imageURL string)
- func GetSpotifyAlbumName(album *spotify.FullAlbum) (name string)
- func GetSpotifyTrackName(track *spotify.SimpleTrack) (name string)
- func RandStringBytes(n int) string
- func SearchTypeString(searchType SearchType) (str string)
- type MockPlayer
- func (p *MockPlayer) CanPlay(url string) (canPlay bool)
- func (p *MockPlayer) GetItems(url string) (items []Song, err error)
- func (p *MockPlayer) Name() (name string)
- func (p *MockPlayer) Pause(pauseState bool) (err error)
- func (p *MockPlayer) Play(url string) (err error)
- func (p *MockPlayer) Seek(positionSeconds int) (err error)
- func (p *MockPlayer) Stop() (err error)
- type Playable
- type PlayableSearchResult
- type SearchType
- type Song
- type SongPlayer
- type SongResult
- type SpotifyPlayer
- func (p *SpotifyPlayer) AddAuthorisationListener(listener func())
- func (p *SpotifyPlayer) CanPlay(url string) (canPlay bool)
- func (p *SpotifyPlayer) GetSongs(url string) (songs []Playable, err error)
- func (p *SpotifyPlayer) Name() (name string)
- func (p *SpotifyPlayer) Pause(pauseState bool) (err error)
- func (p *SpotifyPlayer) Play(url string) (err error)
- func (p *SpotifyPlayer) Search(searchType SearchType, searchStr string, limit int) (results []PlayableSearchResult, err error)
- func (p *SpotifyPlayer) Seek(positionSeconds int) (err error)
- func (p *SpotifyPlayer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (p *SpotifyPlayer) SetPlaybackDevice(playbackDevice string)
- func (p *SpotifyPlayer) Stop() (err error)
- type Type
- type YouTubeAPI
- func (yt *YouTubeAPI) GetPlayableForIdentifier(identifier string) (playable Playable, err error)
- func (yt *YouTubeAPI) GetPlayableForURL(source string) (playable Playable, err error)
- func (yt *YouTubeAPI) GetPlayablesForPlaylistIdentifier(identifier string, limit int) (items []Playable, err error)
- func (yt *YouTubeAPI) GetPlayablesForPlaylistURL(source string) (items []Playable, err error)
- func (yt *YouTubeAPI) Search(searchType SearchType, searchStr string, limit int) (items []PlayableSearchResult, err error)
- type YoutubePlayer
- func (p *YoutubePlayer) CanPlay(url string) (canPlay bool)
- func (p *YoutubePlayer) GetSongs(url string) (songs []Playable, err error)
- func (p *YoutubePlayer) Name() (name string)
- func (p *YoutubePlayer) Play(url string) (err error)
- func (p *YoutubePlayer) Search(searchType SearchType, searchStr string, limit int) (results []PlayableSearchResult, err error)
Constants ¶
View Source
const ( SEARCH_TYPE_TRACK SearchType = iota + 1 SEARCH_TYPE_ALBUM = iota + 1 SEARCH_TYPE_PLAYLIST = iota + 1 )
View Source
const ( DEFAULT_AUTHORISE_PORT = 5678 DEFAULT_AUTHORISE_URL = "http://musicbot:5678/authorise/" MAX_SPOTIFY_PLAYLIST_ITEMS = 1000 )
View Source
const ( YouTubeVideoURL = "https://www.youtube.com/watch?v=%s" YouTubePlaylistURL = "https://www.youtube.com/watch?v=%s&list=%s" MAX_YOUTUBE_PLAYLIST_ITEMS = 500 )
Variables ¶
View Source
var ErrNotAuthorised = errors.New("Client has not been authorised yet")
Functions ¶
func GetSpotifyAlbumImage ¶
func GetSpotifyAlbumImage(album *spotify.SimpleAlbum) (imageURL string)
func GetSpotifyAlbumName ¶
func GetSpotifyTrackName ¶
func GetSpotifyTrackName(track *spotify.SimpleTrack) (name string)
func RandStringBytes ¶
func SearchTypeString ¶
func SearchTypeString(searchType SearchType) (str string)
Types ¶
type MockPlayer ¶ added in v1.5.1
type MockPlayer struct{}
func NewMemoryPlayer ¶
func NewMemoryPlayer() (p *MockPlayer)
func (*MockPlayer) CanPlay ¶ added in v1.5.1
func (p *MockPlayer) CanPlay(url string) (canPlay bool)
func (*MockPlayer) GetItems ¶ added in v1.5.1
func (p *MockPlayer) GetItems(url string) (items []Song, err error)
func (*MockPlayer) Name ¶ added in v1.5.1
func (p *MockPlayer) Name() (name string)
func (*MockPlayer) Pause ¶ added in v1.5.1
func (p *MockPlayer) Pause(pauseState bool) (err error)
func (*MockPlayer) Play ¶ added in v1.5.1
func (p *MockPlayer) Play(url string) (err error)
func (*MockPlayer) Seek ¶ added in v1.5.1
func (p *MockPlayer) Seek(positionSeconds int) (err error)
func (*MockPlayer) Stop ¶ added in v1.5.1
func (p *MockPlayer) Stop() (err error)
type PlayableSearchResult ¶
type PlayableSearchResult interface { Playable GetType() SearchType }
func GetSpotifySearchResults ¶
func GetSpotifySearchResults(spClient *spotify.Client, searchType SearchType, searchStr string, limit int) (results []PlayableSearchResult, err error)
type SearchType ¶
type SearchType uint8
func GetSearchType ¶
func GetSearchType(searchTypeStr string) (ok bool, searchType SearchType)
type SongPlayer ¶
type SongPlayer interface { Name() (name string) CanPlay(url string) (canPlay bool) GetSongs(url string) (songs []Playable, err error) Search(searchType SearchType, searchStr string, limit int) (results []PlayableSearchResult, err error) Play(url string) (err error) Seek(positionSeconds int) (err error) Pause(pauseState bool) (err error) Stop() (err error) }
type SongResult ¶
type SongResult struct { *Song Type SearchType }
func NewSongResult ¶
func NewSongResult(tp SearchType, title string, duration time.Duration, URL, imageURL string) *SongResult
func (*SongResult) GetType ¶
func (sr *SongResult) GetType() SearchType
type SpotifyPlayer ¶
type SpotifyPlayer struct {
// contains filtered or unexported fields
}
func NewSpotifyPlayer ¶
func NewSpotifyPlayer(spotifyClientID, spotifyClientSecret, tokenFilePath, authoriseRedirectURL string, authoriseHTTPPort int) (p *SpotifyPlayer, authURL string, err error)
func (*SpotifyPlayer) AddAuthorisationListener ¶ added in v1.5.1
func (p *SpotifyPlayer) AddAuthorisationListener(listener func())
func (*SpotifyPlayer) CanPlay ¶
func (p *SpotifyPlayer) CanPlay(url string) (canPlay bool)
func (*SpotifyPlayer) GetSongs ¶
func (p *SpotifyPlayer) GetSongs(url string) (songs []Playable, err error)
func (*SpotifyPlayer) Name ¶
func (p *SpotifyPlayer) Name() (name string)
func (*SpotifyPlayer) Pause ¶
func (p *SpotifyPlayer) Pause(pauseState bool) (err error)
func (*SpotifyPlayer) Play ¶
func (p *SpotifyPlayer) Play(url string) (err error)
func (*SpotifyPlayer) Search ¶
func (p *SpotifyPlayer) Search(searchType SearchType, searchStr string, limit int) (results []PlayableSearchResult, err error)
func (*SpotifyPlayer) Seek ¶
func (p *SpotifyPlayer) Seek(positionSeconds int) (err error)
func (*SpotifyPlayer) ServeHTTP ¶ added in v1.5.1
func (p *SpotifyPlayer) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*SpotifyPlayer) SetPlaybackDevice ¶ added in v1.6.0
func (p *SpotifyPlayer) SetPlaybackDevice(playbackDevice string)
func (*SpotifyPlayer) Stop ¶
func (p *SpotifyPlayer) Stop() (err error)
type YouTubeAPI ¶
type YouTubeAPI struct {
// contains filtered or unexported fields
}
func NewYoutubeAPI ¶
func NewYoutubeAPI(youtubeAPIKey string) (yt *YouTubeAPI)
func (*YouTubeAPI) GetPlayableForIdentifier ¶
func (yt *YouTubeAPI) GetPlayableForIdentifier(identifier string) (playable Playable, err error)
func (*YouTubeAPI) GetPlayableForURL ¶
func (yt *YouTubeAPI) GetPlayableForURL(source string) (playable Playable, err error)
GetPlayableForURL - Get meta data for a youtube url
func (*YouTubeAPI) GetPlayablesForPlaylistIdentifier ¶
func (yt *YouTubeAPI) GetPlayablesForPlaylistIdentifier(identifier string, limit int) (items []Playable, err error)
func (*YouTubeAPI) GetPlayablesForPlaylistURL ¶
func (yt *YouTubeAPI) GetPlayablesForPlaylistURL(source string) (items []Playable, err error)
func (*YouTubeAPI) Search ¶
func (yt *YouTubeAPI) Search(searchType SearchType, searchStr string, limit int) (items []PlayableSearchResult, err error)
type YoutubePlayer ¶
type YoutubePlayer struct { *util.MpvControl // contains filtered or unexported fields }
func NewYoutubePlayer ¶
func NewYoutubePlayer(youtubeAPIKey string, mpvControl *util.MpvControl) (player *YoutubePlayer, err error)
func (*YoutubePlayer) CanPlay ¶
func (p *YoutubePlayer) CanPlay(url string) (canPlay bool)
func (*YoutubePlayer) GetSongs ¶
func (p *YoutubePlayer) GetSongs(url string) (songs []Playable, err error)
func (*YoutubePlayer) Name ¶
func (p *YoutubePlayer) Name() (name string)
func (*YoutubePlayer) Play ¶
func (p *YoutubePlayer) Play(url string) (err error)
func (*YoutubePlayer) Search ¶
func (p *YoutubePlayer) Search(searchType SearchType, searchStr string, limit int) (results []PlayableSearchResult, err error)
Click to show internal directories.
Click to hide internal directories.