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) OpenServers(context.Context) error
- func (b *Browser) Prepare(ctx context.Context, h int)
- func (b *Browser) RefreshRoot(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 Rect
- type Row
- type SearchField
- type SpectrumSource
- type Switcher
Constants ¶
const ( MenuArtists = "artists" MenuRecent = "recent" 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 {
// 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) OpenServers ¶
OpenServers lists the account's servers with the current one marked.
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) 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.