Documentation
¶
Index ¶
- Constants
- func Clock(d time.Duration) string
- func DrawDeck(s tcell.Screen, r Rect, st DeckState)
- func DrawHelp(s tcell.Screen, r Rect)
- func DrawTooSmall(s tcell.Screen, w, h int)
- func Fit(text string, width int) string
- func Marquee(text string, width, tick int) string
- func PutStr(s tcell.Screen, x, y int, text string, style tcell.Style) int
- func SeekBarHit(r Rect, x int) float64
- type Action
- type Analyzer
- type App
- type Browser
- func (b *Browser) AlbumContext() ([]library.Track, bool)
- func (b *Browser) AlbumTracks(ctx context.Context, a library.Album) ([]library.Track, error)
- func (b *Browser) Back(context.Context) bool
- func (b *Browser) CurrentServerName() string
- func (b *Browser) JumpLetter(ctx context.Context, r rune) bool
- func (b *Browser) List() *List
- func (b *Browser) LoadRecent(ctx context.Context) error
- func (b *Browser) LoadRoot(context.Context) error
- func (b *Browser) OpenAlbum(ctx context.Context, a library.Album) error
- func (b *Browser) OpenArtist(ctx context.Context, a library.Artist) error
- func (b *Browser) OpenArtists(ctx context.Context) error
- func (b *Browser) OpenPlaylist(ctx context.Context, p library.Playlist) error
- func (b *Browser) OpenPlaylists(ctx context.Context) error
- func (b *Browser) OpenServers(context.Context) error
- func (b *Browser) PlaylistTracks(ctx context.Context, p library.Playlist) ([]library.Track, error)
- func (b *Browser) Prepare(ctx context.Context, h int)
- func (b *Browser) RefreshRoot(ctx context.Context)
- func (b *Browser) ReloadPlaylists(ctx context.Context)
- func (b *Browser) Search(ctx context.Context, q string) error
- func (b *Browser) SetSwitcher(sw Switcher)
- func (b *Browser) SwitchServer(ctx context.Context, id string) bool
- func (b *Browser) Title() string
- type DeckState
- type Layout
- type List
- type Mode
- type Rect
- type Row
- type Saver
- type SearchField
- type SpectrumSource
- type Switcher
Constants ¶
const ( MenuArtists = "artists" MenuRecent = "recent" MenuPlaylists = "playlists" MenuServers = "servers" )
const (
MinW, MinH = 80, 24
)
Variables ¶
This section is empty.
Functions ¶
func DrawTooSmall ¶
func Fit ¶
Fit cuts or pads text to exactly width cells. A wide glyph that would straddle the cut is replaced by a space.
func Marquee ¶
Marquee returns a width-cell window onto text. Text that fits is padded; longer text scrolls one grapheme every 4 ticks with a gap before it repeats.
func PutStr ¶
PutStr writes text at x,y one grapheme cluster at a time, advancing by each cluster's display width, and returns the cells used. It does not clip; callers pass text already cut to width (see Fit).
func SeekBarHit ¶
SeekBarHit maps a click at column x on the seek row to a fraction of the track, or -1 if the click is outside the bar.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func NewAnalyzer ¶
func NewAnalyzer(src SpectrumSource) *Analyzer
type App ¶
type App struct {
// OnVisual is told the new mode's name when v changes it, to persist it.
OnVisual func(name string)
// contains filtered or unexported fields
}
func (*App) SetSwitcher ¶
SetSwitcher enables the Servers menu for a multi-server library.
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser is the Library tab: a stack of views, each a title and a row set. The root is a small menu; Artists is an index of every artist that loads a page at a time as the selection moves.
func NewBrowser ¶
func (*Browser) AlbumContext ¶
AlbumContext returns the album's tracks when the current view is an album.
func (*Browser) AlbumTracks ¶
AlbumTracks is what `a` on an album appends: the same call the view uses.
func (*Browser) CurrentServerName ¶
CurrentServerName is shown in the tab row; empty with a single server.
func (*Browser) JumpLetter ¶
JumpLetter moves the selection to the first artist under r in the Artists view. It reports whether a jump happened.
func (*Browser) OpenArtist ¶
func (*Browser) OpenArtists ¶
OpenArtists opens the index: one row per artist, with only the first page fetched. Rows past it are placeholders until Prepare reaches them.
func (*Browser) OpenPlaylist ¶ added in v0.9.0
OpenPlaylist pushes a playlist's tracks. It carries them as an album view does, so Enter on a track plays the playlist from there.
func (*Browser) OpenPlaylists ¶ added in v0.9.0
OpenPlaylists pushes the list of every server's playlists.
func (*Browser) OpenServers ¶
OpenServers lists the account's servers with the current one marked.
func (*Browser) PlaylistTracks ¶ added in v0.9.0
PlaylistTracks is what `a` on a playlist row appends: the same call the view uses.
func (*Browser) RefreshRoot ¶
RefreshRoot rebuilds the root menu when the number of servers has changed since it was built, which happens as background connections finish. It does nothing when a deeper view is open.
func (*Browser) ReloadPlaylists ¶ added in v0.9.0
ReloadPlaylists refetches the list when it is the open view, keeping the selection, so a playlist saved a moment ago appears. Deeper views are left alone.
func (*Browser) SetSwitcher ¶
SetSwitcher enables the Servers menu and names servers in search results.
func (*Browser) SwitchServer ¶
SwitchServer makes id the current server for browsing and returns to the root menu. It reports whether the switch happened.
type Mode ¶ added in v0.3.0
type Mode int
Mode selects what the analyzer pane draws from the tap.
type Row ¶
type Row struct {
Text, Right string
Header bool
Menu string // a root menu entry: MenuArtists, MenuRecent or MenuServers
ServerID string // a server row in the Servers view
Album *library.Album
Track *library.Track
Artist *library.Artist
Playlist *library.Playlist
Playing bool
// contains filtered or unexported fields
}
type Saver ¶ added in v0.9.0
type Saver interface {
SaveQueue(ctx context.Context, name string, tracks []library.Track) ([]library.Saved, error)
}
Saver saves a queue to the servers its tracks live on.