Documentation ¶
Index ¶
- type BaseSonglist
- func (s *BaseSonglist) Add(song *song.Song) error
- func (s *BaseSonglist) AddFromAttrlist(attrlist []mpd.Attrs)
- func (s *BaseSonglist) AddList(songlist Songlist) error
- func (s *BaseSonglist) Clear() error
- func (s *BaseSonglist) ClearSelection()
- func (s *BaseSonglist) Columns(columns []string) Columns
- func (s *BaseSonglist) CommitVisualSelection()
- func (s *BaseSonglist) Cursor() int
- func (s *BaseSonglist) CursorSong() *song.Song
- func (s *BaseSonglist) CursorToSong(song *song.Song) error
- func (s *BaseSonglist) Delete() error
- func (s *BaseSonglist) DisableVisualSelection()
- func (s *BaseSonglist) Duplicate(dest Songlist) error
- func (s *BaseSonglist) EnableVisualSelection()
- func (s *BaseSonglist) HasVisualSelection() bool
- func (s *BaseSonglist) InRange(index int) bool
- func (s *BaseSonglist) IndexAtSong(i int, song *song.Song) bool
- func (s *BaseSonglist) Indices(indices []int) Songlist
- func (s *BaseSonglist) Insert(song *song.Song, position int) error
- func (s *BaseSonglist) InsertList(list Songlist, position int) error
- func (s *BaseSonglist) Len() int
- func (s *BaseSonglist) Locate(match *song.Song) (int, error)
- func (s *BaseSonglist) Lock()
- func (s *BaseSonglist) ManuallySelected(i int) bool
- func (s *BaseSonglist) MoveCursor(i int)
- func (s *BaseSonglist) MoveCursorDown(i int)
- func (s *BaseSonglist) MoveCursorUp(i int)
- func (s *BaseSonglist) Name() string
- func (s *BaseSonglist) NextOf(tags []string, index int, direction int) int
- func (s *BaseSonglist) Remove(index int) error
- func (s *BaseSonglist) RemoveIndices(indices []int) error
- func (s *BaseSonglist) Replace(index int, song *song.Song) error
- func (s *BaseSonglist) Selected(i int) bool
- func (s *BaseSonglist) Selection() Songlist
- func (s *BaseSonglist) SelectionIndices() []int
- func (s *BaseSonglist) SetCursor(i int)
- func (s *BaseSonglist) SetName(name string) error
- func (s *BaseSonglist) SetSelected(i int, selected bool)
- func (s *BaseSonglist) SetUpdated()
- func (s *BaseSonglist) SetVisualSelection(ymin, ymax, ystart int)
- func (s *BaseSonglist) Song(i int) *song.Song
- func (s *BaseSonglist) Songs() []*song.Song
- func (s *BaseSonglist) Sort(fields []string) error
- func (s *BaseSonglist) ToggleVisualSelection()
- func (s *BaseSonglist) Truncate(length int) error
- func (s *BaseSonglist) Unlock()
- func (s *BaseSonglist) Updated() time.Time
- func (s *BaseSonglist) ValidateCursor(ymin, ymax int)
- func (s *BaseSonglist) VisualSelection() (int, int, int)
- func (s *BaseSonglist) VisuallySelected(i int) bool
- type Collection
- func (c *Collection) Activate(s Songlist)
- func (c *Collection) ActivateIndex(i int) error
- func (c *Collection) Add(s Songlist)
- func (c *Collection) Current() Songlist
- func (c *Collection) Index() (int, error)
- func (c *Collection) Last() Songlist
- func (c *Collection) Len() int
- func (c *Collection) Remove(index int) error
- func (c *Collection) Replace(s Songlist)
- func (c *Collection) SetUpdated()
- func (c *Collection) Songlist(index int) (Songlist, error)
- func (c *Collection) Updated() time.Time
- func (c *Collection) ValidIndex(i int) bool
- func (c *Collection) ValidateIndex(i int) error
- type Column
- func (c *Column) Add(song *song.Song)
- func (c *Column) Avg() int
- func (c *Column) MaxWidth() int
- func (c *Column) Remove(song *song.Song)
- func (c *Column) Reset()
- func (c *Column) Set(s Songlist)
- func (c *Column) SetWidth(width int)
- func (c *Column) Tag() string
- func (c *Column) Weight(max int) float64
- func (c *Column) Width() int
- type ColumnMap
- type Columns
- type Library
- func (s *Library) Clear() error
- func (s *Library) CloseIndex() error
- func (s *Library) Delete() error
- func (s *Library) HasIndex() bool
- func (s *Library) IndexSynced() bool
- func (s *Library) Isolate(songs Songlist, tags []string) (Songlist, error)
- func (s *Library) Name() string
- func (s *Library) OpenIndex(path string) error
- func (s *Library) ReIndex()
- func (s *Library) Remove(index int) error
- func (s *Library) RemoveIndices(indices []int) error
- func (s *Library) Search(q string) (Songlist, error)
- func (s *Library) SetName(name string) error
- func (s *Library) SetVersion(version int)
- func (s *Library) Sort(fields []string) error
- func (s *Library) Version() int
- type Queue
- func (s *Queue) Add(song *song.Song) error
- func (s *Queue) AddList(songlist Songlist) error
- func (s *Queue) Clear() error
- func (s *Queue) Delete() error
- func (q *Queue) IndexAtSong(i int, song *song.Song) bool
- func (s *Queue) Insert(song *song.Song, position int) error
- func (s *Queue) InsertList(list Songlist, position int) error
- func (q *Queue) Merge(s Songlist) (*Queue, error)
- func (s *Queue) Name() string
- func (s *Queue) Remove(index int) error
- func (s *Queue) RemoveIndices(indices []int) error
- func (s *Queue) SetName(name string) error
- func (s *Queue) Sort(fields []string) error
- type Songlist
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseSonglist ¶
type BaseSonglist struct {
// contains filtered or unexported fields
}
func New ¶
func New() (s *BaseSonglist)
func (*BaseSonglist) Add ¶
func (s *BaseSonglist) Add(song *song.Song) error
Add adds a song to the songlist.
func (*BaseSonglist) AddFromAttrlist ¶
func (s *BaseSonglist) AddFromAttrlist(attrlist []mpd.Attrs)
func (*BaseSonglist) AddList ¶
func (s *BaseSonglist) AddList(songlist Songlist) error
AddList appends a songlist to this songlist.
func (*BaseSonglist) Clear ¶
func (s *BaseSonglist) Clear() error
Clear clears the songlist by removing any songs.
func (*BaseSonglist) ClearSelection ¶
func (s *BaseSonglist) ClearSelection()
ClearSelection removes all selection.
func (*BaseSonglist) Columns ¶
func (s *BaseSonglist) Columns(columns []string) Columns
Columns returns a slice of columns, containing only the columns which has the specified tags.
func (*BaseSonglist) CommitVisualSelection ¶
func (s *BaseSonglist) CommitVisualSelection()
CommitVisualSelection converts the visual selection to manual selection.
func (*BaseSonglist) Cursor ¶
func (s *BaseSonglist) Cursor() int
Cursor returns the cursor position.
func (*BaseSonglist) CursorSong ¶
func (s *BaseSonglist) CursorSong() *song.Song
CursorSong returns the song currently selected by the cursor.
func (*BaseSonglist) CursorToSong ¶
func (s *BaseSonglist) CursorToSong(song *song.Song) error
func (*BaseSonglist) Delete ¶
func (s *BaseSonglist) Delete() error
Delete deletes a songlist. This is a placeholder function that should be overridden by other classes that need to trigger an action on the MPD side.
func (*BaseSonglist) DisableVisualSelection ¶
func (s *BaseSonglist) DisableVisualSelection()
DisableVisualSelection disables visual selection.
func (*BaseSonglist) Duplicate ¶
func (s *BaseSonglist) Duplicate(dest Songlist) error
Duplicate makes a copy of the current songlist, and places it in dest.
func (*BaseSonglist) EnableVisualSelection ¶
func (s *BaseSonglist) EnableVisualSelection()
EnableVisualSelection sets start and stop of the visual selection to the cursor position.
func (*BaseSonglist) HasVisualSelection ¶
func (s *BaseSonglist) HasVisualSelection() bool
HasVisualSelection returns true if the songlist is in visual selection mode.
func (*BaseSonglist) InRange ¶
func (s *BaseSonglist) InRange(index int) bool
InRange returns true if the provided index is within songlist range, false otherwise.
func (*BaseSonglist) IndexAtSong ¶
func (s *BaseSonglist) IndexAtSong(i int, song *song.Song) bool
IndexAtSong returns true if the song at the specified index is at a song with the same ID, or the path if the songlist is not a queue.
func (*BaseSonglist) Indices ¶
func (s *BaseSonglist) Indices(indices []int) Songlist
Indices accepts a slice of integers pointing to song positions, returns a new songlist with those songs. Any mismatching integers are ignored.
func (*BaseSonglist) Insert ¶
func (s *BaseSonglist) Insert(song *song.Song, position int) error
Insert inserts a song at the specified position.
func (*BaseSonglist) InsertList ¶
func (s *BaseSonglist) InsertList(list Songlist, position int) error
InsertList inserts the songs in a songlist into this songlist, at a specified position.
func (*BaseSonglist) Len ¶
func (s *BaseSonglist) Len() int
func (*BaseSonglist) Lock ¶
func (s *BaseSonglist) Lock()
func (*BaseSonglist) ManuallySelected ¶
func (s *BaseSonglist) ManuallySelected(i int) bool
ManuallySelected returns true if the given song index is selected through manual selection.
func (*BaseSonglist) MoveCursor ¶
func (s *BaseSonglist) MoveCursor(i int)
MoveCursorUp moves the cursor by the specified offset.
func (*BaseSonglist) MoveCursorDown ¶
func (s *BaseSonglist) MoveCursorDown(i int)
MoveCursorUp moves the cursor down by the specified offset.
func (*BaseSonglist) MoveCursorUp ¶
func (s *BaseSonglist) MoveCursorUp(i int)
MoveCursorUp moves the cursor up by the specified offset.
func (*BaseSonglist) Name ¶
func (s *BaseSonglist) Name() string
func (*BaseSonglist) NextOf ¶
func (s *BaseSonglist) NextOf(tags []string, index int, direction int) int
NextOf searches forwards or backwards for songs having different tags than the specified song. The index of the next song is returned.
func (*BaseSonglist) Remove ¶
func (s *BaseSonglist) Remove(index int) error
func (*BaseSonglist) RemoveIndices ¶
func (s *BaseSonglist) RemoveIndices(indices []int) error
RemoveIndices removes a selection of songs from the songlist, having the index defined by the int slice parameter.
func (*BaseSonglist) Selected ¶
func (s *BaseSonglist) Selected(i int) bool
Selected returns true if the given song index is selected, either through visual selection or manual selection. If the song is doubly selected, the selection is inversed.
func (*BaseSonglist) Selection ¶
func (s *BaseSonglist) Selection() Songlist
Selection returns the current selection as a new Songlist.
func (*BaseSonglist) SelectionIndices ¶
func (s *BaseSonglist) SelectionIndices() []int
SelectionIndices returns a slice of ints holding the position of each element in the current selection. If no elements are selected, the cursor position is returned.
func (*BaseSonglist) SetCursor ¶
func (s *BaseSonglist) SetCursor(i int)
SetCursor sets the cursor to an absolute position.
func (*BaseSonglist) SetName ¶
func (s *BaseSonglist) SetName(name string) error
func (*BaseSonglist) SetSelected ¶
func (s *BaseSonglist) SetSelected(i int, selected bool)
SetSelection sets the selected status of a single song.
func (*BaseSonglist) SetUpdated ¶
func (s *BaseSonglist) SetUpdated()
SetUpdated sets the update timestamp of the songlist.
func (*BaseSonglist) SetVisualSelection ¶
func (s *BaseSonglist) SetVisualSelection(ymin, ymax, ystart int)
SetVisualSelection sets the range of the visual selection. Use negative integers to un-select all visually selected songs.
func (*BaseSonglist) Songs ¶
func (s *BaseSonglist) Songs() []*song.Song
func (*BaseSonglist) Sort ¶
func (s *BaseSonglist) Sort(fields []string) error
Sort sorts the songlist by the given tags. The first tag is sorted normally, while the remaining tags are used for stable sorting.
func (*BaseSonglist) ToggleVisualSelection ¶
func (s *BaseSonglist) ToggleVisualSelection()
ToggleVisualSelection toggles visual selection on and off.
func (*BaseSonglist) Truncate ¶
func (s *BaseSonglist) Truncate(length int) error
func (*BaseSonglist) Unlock ¶
func (s *BaseSonglist) Unlock()
func (*BaseSonglist) Updated ¶
func (s *BaseSonglist) Updated() time.Time
Updated returns the timestamp of when this songlist was last updated.
func (*BaseSonglist) ValidateCursor ¶
func (s *BaseSonglist) ValidateCursor(ymin, ymax int)
ValidateCursor makes sure the cursor is within minimum and maximum boundaries.
func (*BaseSonglist) VisualSelection ¶
func (s *BaseSonglist) VisualSelection() (int, int, int)
VisualSelection returns the min, max, and start position of visual select.
func (*BaseSonglist) VisuallySelected ¶
func (s *BaseSonglist) VisuallySelected(i int) bool
VisuallySelected returns true if the given song index is selected through visual selection.
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection holds a set of songlists, and keeps track of movement between different lists.
func (*Collection) Activate ¶
func (c *Collection) Activate(s Songlist)
Activate activates the specified songlist. The songlist is not added to the collection. If the songlist is found in the collection, the index of that songlist is activated.
func (*Collection) ActivateIndex ¶
func (c *Collection) ActivateIndex(i int) error
ActivateIndex activates the songlist pointed to by the specified index.
func (*Collection) Add ¶
func (c *Collection) Add(s Songlist)
Add appends a songlist to the collection.
func (*Collection) Current ¶
func (c *Collection) Current() Songlist
Current returns the active songlist.
func (*Collection) Index ¶
func (c *Collection) Index() (int, error)
Index returns the current list cursor.
func (*Collection) Remove ¶
func (c *Collection) Remove(index int) error
Remove removes a songlist from the collection.
func (*Collection) Replace ¶
func (c *Collection) Replace(s Songlist)
Replace replaces an existing songlist with its new version. Checking is done on a type-level, so this function should not be used for lists where several of the same type is contained within the collection.
func (*Collection) SetUpdated ¶
func (c *Collection) SetUpdated()
SetUpdated sets the update timestamp of the collection.
func (*Collection) Updated ¶
func (c *Collection) Updated() time.Time
Updated returns the timestamp of when this collection was last updated.
func (*Collection) ValidIndex ¶
func (c *Collection) ValidIndex(i int) bool
func (*Collection) ValidateIndex ¶
func (c *Collection) ValidateIndex(i int) error
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
type Library ¶
type Library struct { BaseSonglist // contains filtered or unexported fields }
Library is a Songlist which represents the MPD song library.
func NewLibrary ¶
func NewLibrary() (s *Library)
func (*Library) CloseIndex ¶
CloseIndex closes the Bleve search index.
func (*Library) IndexSynced ¶
IndexSynced returns true if the search index is up to date with the MPD version.
func (*Library) Isolate ¶
Isolate takes a songlist and a set of tag keys, and matches the tag values of the songlist against the search index.
func (*Library) OpenIndex ¶
OpenIndex configures the library to use the Bleve search index at the specified path.
func (*Library) ReIndex ¶
func (s *Library) ReIndex()
ReIndex starts an asynchronous reindexing job. In case this function is called again before reindexing is done, ReIndex will abort the old reindexing job.
func (*Library) RemoveIndices ¶
func (*Library) Search ¶
Search does a search in the Bleve index for a specific natural language query string, and returns a new Songlist with the search results.
func (*Library) SetVersion ¶
SetVersion sets the library version. This is expected to be a UNIX timestamp.
type Queue ¶
type Queue struct { BaseSonglist // contains filtered or unexported fields }
Queue is a Songlist which represents the MPD play queue.
func (*Queue) IndexAtSong ¶
IndexAtSong returns true if the song at the specified index is at a song with the same ID.
func (*Queue) InsertList ¶
InsertList inserts the songs in a songlist into the queue, at a specified position.
func (*Queue) Merge ¶
Merge incorporates songs from another songlist, replacing songs that has the same position.
func (*Queue) RemoveIndices ¶
RemoveIndices removes a selection of songs from MPD's queue.
type Songlist ¶
type Songlist interface { Add(*song.Song) error AddList(Songlist) error Clear() error Delete() error Duplicate(Songlist) error Indices([]int) Songlist InRange(int) bool Insert(*song.Song, int) error InsertList(Songlist, int) error Len() int Locate(*song.Song) (int, error) Lock() Name() string NextOf([]string, int, int) int Remove(int) error RemoveIndices([]int) error Replace(int, *song.Song) error SetName(string) error Song(int) *song.Song Songs() []*song.Song Sort([]string) error Truncate(int) error Unlock() ClearSelection() Columns([]string) Columns CommitVisualSelection() Cursor() int CursorSong() *song.Song CursorToSong(*song.Song) error DisableVisualSelection() EnableVisualSelection() HasVisualSelection() bool IndexAtSong(int, *song.Song) bool MoveCursor(int) Selected(int) bool Selection() Songlist SelectionIndices() []int SetCursor(int) SetSelected(int, bool) SetUpdated() SetVisualSelection(int, int, int) ToggleVisualSelection() Updated() time.Time ValidateCursor(int, int) }