Documentation
¶
Index ¶
- type Action
- type Content
- func (c *Content) AddSongs(songs []*models.Song)
- func (c *Content) ClearQueue()
- func (c *Content) Continue()
- func (c *Content) GetChildren(parent models.Id, parentType models.ItemType)
- func (c *Content) GetDefault() []models.Item
- func (c *Content) GetHistory(n int) []*models.SongInfo
- func (c *Content) GetItem(id models.Id, itemType models.ItemType)
- func (c *Content) GetItems(ids []models.Id, itemType models.ItemType)
- func (c *Content) GetParent(child models.Id, childType models.ItemType)
- func (c *Content) GetQueue() []*models.SongInfo
- func (c *Content) GetView(view View)
- func (c *Content) Next()
- func (c *Content) Pause()
- func (c *Content) Previous()
- func (c *Content) QueueDuration() int
- func (c *Content) RemoveItemsCallback()
- func (c *Content) RemoveQueueChangedCallback()
- func (c *Content) Reorder(currentIndex, newIndex int)
- func (c *Content) Search(q string)
- func (c *Content) SearchCompleteChan() chan Action
- func (c *Content) SearchResults() *api.SearchResult
- func (c *Content) Seek(seconds int)
- func (c *Content) SeekBackwards(seconds int)
- func (c *Content) SetItemsCallback(cb func([]models.Item))
- func (c *Content) SetQueueChangedCallback(cb func(content []*models.Song))
- func (c *Content) SetStatusCallback(cb func(state player.PlayingState))
- func (c *Content) SetVolume(level int)
- func (c *Content) StopMedia()
- type ItemController
- type MediaController
- type PlaybackController
- type QueueController
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Content ¶
func (*Content) GetChildren ¶
func (*Content) SearchResults ¶
func (c *Content) SearchResults() *api.SearchResult
SearchResults returns latest search results from index to index.
func (*Content) SetQueueChangedCallback ¶
func (*Content) SetStatusCallback ¶
func (c *Content) SetStatusCallback(cb func(state player.PlayingState))
type ItemController ¶
type ItemController interface {
//GetItem gets item with given id. If none found or if errors, return nil
GetItem(id models.Id, itemType models.ItemType)
//GetItems get multiple items for given ids.
GetItems(ids []models.Id, itemType models.ItemType)
//GetChildren returns children for given parent id. If there are none, returns nil
GetChildren(parent models.Id, parentType models.ItemType)
//GetParent returns parent for child id. If there is no parent, return nil
GetParent(child models.Id, childType models.ItemType)
//SetItemsCallback sets callback that gets called when items are retrieved
SetItemsCallback(func([]models.Item))
//RemoveItemsCallback removes items callback if there's any
RemoveItemsCallback()
//GetView shows one of predefined views
GetView(view View)
}
ItemController retrieves children and returns them with ItemsCallback Manages item metadata and not the files themselves. If itemsCallback is not set, no results will be retrieved.
type MediaController ¶
type MediaController interface {
ItemController
QueueController
PlaybackController
}
MusicController gathers all necessary interfaces that can control media and queue plus query item metadata
type PlaybackController ¶
type PlaybackController interface {
//Pause pauses media that's currently playing. If none, do nothing.
Pause()
//Continue continues currently paused media.
Continue()
//StopMedia stops playing media.
StopMedia()
//Next plays currently next item in queue, if any.
Next()
//Previous plays last played song (first in history)
Previous()
//Seek seeks forward given seconds
Seek(seconds int)
//SeekBackwards seeks backwards given seconds
SeekBackwards(seconds int)
//SetStatusCallback sets callback that get's called every time status has changed,
//including playback progress
SetStatusCallback(func(state player.PlayingState))
//SetVolume sets volume to given level in range of [0,100]
SetVolume(level int)
}
PlaybackController controls media playback. Current status is sent to StatusCallback, if set.
type QueueController ¶
type QueueController interface {
//GetQueue gets currently ongoing queue of items with complete info for each song
GetQueue() []*models.SongInfo
//ClearQueue clears queue. This also calls QueueChangedCallback
ClearQueue()
//QueueDuration gets number of queue items
QueueDuration() int
//AddItems adds items to the end of queue.
//Adding items calls QueueChangedCallback
AddSongs([]*models.Song)
//Reorder sets item in index currentIndex to newIndex.
//If either currentIndex or NewIndex is not valid, do nothing.
//On successful order QueueChangedCallback gets called.
Reorder(currentIndex, newIndex int)
//GetHistory get's n past songs that has been played.
GetHistory(n int) []*models.SongInfo
//SetQueueChangedCallback sets function that is called every time queue changes.
SetQueueChangedCallback(func(content []*models.Song))
//RemoveQueueChangedCallback removes queue changed callback
RemoveQueueChangedCallback()
}
QueueController controls queue and history If no queueChangedCallback is set, no queue updates will be returned
Source Files
¶
- content.go
- interfaces.go
- queue.go
Click to show internal directories.
Click to hide internal directories.