ui

package
v0.0.0-...-78ec99f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ImgX int
	ImgY int
	ImgW int
	ImgH int
)
View Source
var (
	TrackStyle         tcell.Style
	AlbumStyle         tcell.Style
	ArtistStyle        tcell.Style
	TimeStyle          tcell.Style
	GenreStyle         tcell.Style
	PlaylistNavStyle   tcell.Style
	NavStyle           tcell.Style
	ContextMenuStyle   tcell.Style
	NotSelectableStyle tcell.Style
)
View Source
var (
	App *tview.Application

	Main *interactiveView

	Flex *tview.Flex
)

Functions

func GetCell

func GetCell(text string, st tcell.Style) *tview.TableCell

func InitNotifier

func InitNotifier()

Start Notification Service

func Map

func Map[K any, V any](a []K, f func(K) V) (res []V)

func NewApplication

func NewApplication() *tview.Application

func NewInteractiveView

func NewInteractiveView() *interactiveView

func NewMenu

func NewMenu() *menu

func NewSearchBar

func NewSearchBar() *tview.InputField

func RefreshProgress

func RefreshProgress(force bool)

func SendNotification

func SendNotification(format string, args ...any)

func SendNotificationWithChan

func SendNotificationWithChan(format string, args ...any) chan string

SendNotificationWithChan sends a notification that won't be closed unless an update message isn't sent over the channel that it returns. The message string received over the channel is then displayed for half a second and the notification is then removed.

func SendNotificationWithTimer

func SendNotificationWithTimer(t time.Duration, format string, args ...any)

func SetCurrentView

func SetCurrentView(v View)

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action represents the Event Handler to the events that are passed to the InputCapture of the tview Widgets. It will refresh the state of the Refreshable r upon every subsequent call to the function that is being returned by the GetFunc()

func NewAction

func NewAction(f ActionFunc, refreshes Refreshable) *Action

func (*Action) Func

func (a *Action) Func() ActionFunc

func (*Action) SetFunc

func (a *Action) SetFunc(f ActionFunc)

func (*Action) SetRefreshable

func (a *Action) SetRefreshable(r Refreshable)

type ActionFunc

type ActionFunc func(e *tcell.EventKey) *tcell.EventKey

type AlbumView

type AlbumView struct {
	*DefaultView
	// contains filtered or unexported fields
}

func NewAlbumView

func NewAlbumView() *AlbumView

func (*AlbumView) AddToPlaylist

func (a *AlbumView) AddToPlaylist()

func (*AlbumView) AddToPlaylistVisual

func (a *AlbumView) AddToPlaylistVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (*AlbumView) Content

func (a *AlbumView) Content() func() [][]Content

func (AlbumView) ExternalInputCapture

func (d AlbumView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*AlbumView) Name

func (a *AlbumView) Name() string

func (*AlbumView) OpenEntry

func (a *AlbumView) OpenEntry()

func (*AlbumView) QueueEntry

func (a *AlbumView) QueueEntry()

func (*AlbumView) QueueSongsVisual

func (a *AlbumView) QueueSongsVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (AlbumView) SetActions

func (d AlbumView) SetActions(a map[string]*Action)

func (*AlbumView) SetAlbum

func (a *AlbumView) SetAlbum(name string, al *spotify.ID)

func (AlbumView) SetMappings

func (d AlbumView) SetMappings(m map[string]map[config.Key]string)

func (AlbumView) SetVisualActions

func (d AlbumView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (AlbumView) VisualCapture

func (d AlbumView) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type AlbumsView

type AlbumsView struct {
	*DefaultViewNone
	// contains filtered or unexported fields
}

func NewAlbumsView

func NewAlbumsView() *AlbumsView

func (*AlbumsView) Content

func (a *AlbumsView) Content() func() [][]Content

func (AlbumsView) ExternalInputCapture

func (d AlbumsView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*AlbumsView) Name

func (a *AlbumsView) Name() string

func (*AlbumsView) OpenEntry

func (a *AlbumsView) OpenEntry()

func (*AlbumsView) PlayEntry

func (a *AlbumsView) PlayEntry()

func (*AlbumsView) QueueEntry

func (a *AlbumsView) QueueEntry()

func (AlbumsView) SetActions

func (d AlbumsView) SetActions(a map[string]*Action)

func (AlbumsView) SetMappings

func (d AlbumsView) SetMappings(m map[string]map[config.Key]string)

func (AlbumsView) SetVisualActions

func (d AlbumsView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

type ArtistView

type ArtistView struct {
	*DefaultViewNone
	// contains filtered or unexported fields
}

func NewArtistView

func NewArtistView() *ArtistView

func (*ArtistView) Content

func (a *ArtistView) Content() func() [][]Content

func (ArtistView) ExternalInputCapture

func (d ArtistView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*ArtistView) Name

func (a *ArtistView) Name() string

func (*ArtistView) OpenEntry

func (a *ArtistView) OpenEntry()

func (*ArtistView) PlayEntry

func (a *ArtistView) PlayEntry()

func (*ArtistView) QueueEntry

func (a *ArtistView) QueueEntry()

func (*ArtistView) RefreshState

func (a *ArtistView) RefreshState()

func (ArtistView) SetActions

func (d ArtistView) SetActions(a map[string]*Action)

func (*ArtistView) SetArtist

func (a *ArtistView) SetArtist(id *spotify.ID)

func (ArtistView) SetMappings

func (d ArtistView) SetMappings(m map[string]map[config.Key]string)

func (ArtistView) SetVisualActions

func (d ArtistView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

type ArtistsView

type ArtistsView struct {
	*DefaultViewNone
	// contains filtered or unexported fields
}

func NewArtistsView

func NewArtistsView() *ArtistsView

func (*ArtistsView) Content

func (a *ArtistsView) Content() func() [][]Content

func (ArtistsView) ExternalInputCapture

func (d ArtistsView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*ArtistsView) Name

func (a *ArtistsView) Name() string

func (*ArtistsView) OpenEntry

func (a *ArtistsView) OpenEntry()

func (*ArtistsView) PlayEntry

func (a *ArtistsView) PlayEntry()

func (ArtistsView) SetActions

func (d ArtistsView) SetActions(a map[string]*Action)

func (ArtistsView) SetMappings

func (d ArtistsView) SetMappings(m map[string]map[config.Key]string)

func (ArtistsView) SetVisualActions

func (d ArtistsView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

type CenteredWidget

type CenteredWidget interface {
	Primitive() *tview.Table
	ContentHandler()
	SelectionHandler() func(s int)
	Size(mw, mh int) (int, int, int, int)
}

type Content

type Content struct {
	Content string
	Style   tcell.Style
}

type CoverArt

type CoverArt struct {
	*tview.Box
	// contains filtered or unexported fields
}

func (*CoverArt) RefreshState

func (c *CoverArt) RefreshState()

type DefaultView

type DefaultView struct {
	// contains filtered or unexported fields
}

func (*DefaultView) DisableVisualMode

func (d *DefaultView) DisableVisualMode() bool

func (DefaultView) ExternalInputCapture

func (d DefaultView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (DefaultView) SetActions

func (d DefaultView) SetActions(a map[string]*Action)

func (DefaultView) SetMappings

func (d DefaultView) SetMappings(m map[string]map[config.Key]string)

func (DefaultView) SetVisualActions

func (d DefaultView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (DefaultView) VisualCapture

func (d DefaultView) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type DefaultViewNone

type DefaultViewNone struct {
	// contains filtered or unexported fields
}

func (*DefaultViewNone) DisableVisualMode

func (a *DefaultViewNone) DisableVisualMode() bool

func (DefaultViewNone) ExternalInputCapture

func (d DefaultViewNone) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (DefaultViewNone) SetActions

func (d DefaultViewNone) SetActions(a map[string]*Action)

func (DefaultViewNone) SetMappings

func (d DefaultViewNone) SetMappings(m map[string]map[config.Key]string)

func (DefaultViewNone) SetVisualActions

func (d DefaultViewNone) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (*DefaultViewNone) VisualCapture

func (a *DefaultViewNone) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type LikedSongsView

type LikedSongsView struct {
	*DefaultView
	// contains filtered or unexported fields
}

func NewLikedSongsView

func NewLikedSongsView() *LikedSongsView

func (*LikedSongsView) AddToPlaylist

func (l *LikedSongsView) AddToPlaylist()

func (*LikedSongsView) AddToPlaylistVisual

func (l *LikedSongsView) AddToPlaylistVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (*LikedSongsView) Content

func (p *LikedSongsView) Content() func() [][]Content

func (LikedSongsView) ExternalInputCapture

func (d LikedSongsView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*LikedSongsView) Name

func (l *LikedSongsView) Name() string

func (*LikedSongsView) OpenEntry

func (l *LikedSongsView) OpenEntry()

func (*LikedSongsView) QueueEntry

func (l *LikedSongsView) QueueEntry()

func (*LikedSongsView) QueueSongsVisual

func (l *LikedSongsView) QueueSongsVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (*LikedSongsView) RefreshState

func (l *LikedSongsView) RefreshState()

func (LikedSongsView) SetActions

func (d LikedSongsView) SetActions(a map[string]*Action)

func (LikedSongsView) SetMappings

func (d LikedSongsView) SetMappings(m map[string]map[config.Key]string)

func (LikedSongsView) SetVisualActions

func (d LikedSongsView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (LikedSongsView) VisualCapture

func (d LikedSongsView) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey
type NavMenu struct {
	*tview.Table
	// contains filtered or unexported fields
}

func NewNavMenu

func NewNavMenu(m []navItem) *NavMenu
func (d NavMenu) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey
func (n *NavMenu) OpenEntry(e *tcell.EventKey) *tcell.EventKey
func (d NavMenu) SetActions(a map[string]*Action)
func (d NavMenu) SetMappings(m map[string]map[config.Key]string)
func (d NavMenu) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)
func (d NavMenu) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type PlaylistNav

type PlaylistNav struct {
	*tview.Table
	Playlists *spt.UserPlaylists
	// contains filtered or unexported fields
}

func NewPlaylistNav

func NewPlaylistNav() *PlaylistNav

func (PlaylistNav) ExternalInputCapture

func (d PlaylistNav) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*PlaylistNav) PlayEntry

func (v *PlaylistNav) PlayEntry(e *tcell.EventKey) *tcell.EventKey

func (*PlaylistNav) QueueEntry

func (v *PlaylistNav) QueueEntry(e *tcell.EventKey) *tcell.EventKey

func (*PlaylistNav) RefreshState

func (v *PlaylistNav) RefreshState()

func (PlaylistNav) SetActions

func (d PlaylistNav) SetActions(a map[string]*Action)

func (PlaylistNav) SetMappings

func (d PlaylistNav) SetMappings(m map[string]map[config.Key]string)

func (PlaylistNav) SetVisualActions

func (d PlaylistNav) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (PlaylistNav) VisualCapture

func (d PlaylistNav) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type PlaylistView

type PlaylistView struct {
	*DefaultView
	// contains filtered or unexported fields
}

func NewPlaylistView

func NewPlaylistView() *PlaylistView

func (*PlaylistView) AddToPlaylist

func (p *PlaylistView) AddToPlaylist()

func (*PlaylistView) AddToPlaylistVisual

func (p *PlaylistView) AddToPlaylistVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (*PlaylistView) Content

func (p *PlaylistView) Content() func() [][]Content

func (PlaylistView) ExternalInputCapture

func (d PlaylistView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*PlaylistView) Name

func (p *PlaylistView) Name() string

func (*PlaylistView) OpenEntry

func (p *PlaylistView) OpenEntry()

func (*PlaylistView) QueueEntry

func (p *PlaylistView) QueueEntry()

func (*PlaylistView) QueueSongsVisual

func (p *PlaylistView) QueueSongsVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (PlaylistView) SetActions

func (d PlaylistView) SetActions(a map[string]*Action)

func (PlaylistView) SetMappings

func (d PlaylistView) SetMappings(m map[string]map[config.Key]string)

func (*PlaylistView) SetPlaylist

func (p *PlaylistView) SetPlaylist(pl *spotify.SimplePlaylist)

func (PlaylistView) SetVisualActions

func (d PlaylistView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (PlaylistView) VisualCapture

func (d PlaylistView) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type ProgressBar

type ProgressBar struct {
	*tview.Box
	BarTitle    string
	BarText     string
	BarTopTitle string
	// contains filtered or unexported fields
}

ProgressBar is a two-lined Box. First line is the BarTitle Second being the actual progress done. Use SetProgressFunc to provide the callback which provides the Fields each time the ProgressBar will be Drawn. The progressFunc must return (BarTitle, BarTopTitle, BarText, percentage) respectively

func NewProgressBar

func NewProgressBar() *ProgressBar

func (*ProgressBar) Draw

func (self *ProgressBar) Draw(screen tcell.Screen)

func (*ProgressBar) RefreshState

func (self *ProgressBar) RefreshState()

func (*ProgressBar) SetProgressFunc

func (self *ProgressBar) SetProgressFunc(pfunc func() (string, string, string, float64)) *ProgressBar

type RecentlyPlayedView

type RecentlyPlayedView struct {
	*DefaultView
	// contains filtered or unexported fields
}

func NewRecentlyPlayedView

func NewRecentlyPlayedView() *RecentlyPlayedView

func (*RecentlyPlayedView) AddToPlaylist

func (r *RecentlyPlayedView) AddToPlaylist()

func (*RecentlyPlayedView) AddToPlaylistVisual

func (r *RecentlyPlayedView) AddToPlaylistVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (*RecentlyPlayedView) Content

func (r *RecentlyPlayedView) Content() func() [][]Content

func (RecentlyPlayedView) ExternalInputCapture

func (d RecentlyPlayedView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*RecentlyPlayedView) Name

func (r *RecentlyPlayedView) Name() string

func (*RecentlyPlayedView) OpenEntry

func (re *RecentlyPlayedView) OpenEntry()

func (*RecentlyPlayedView) QueueEntry

func (re *RecentlyPlayedView) QueueEntry()

func (*RecentlyPlayedView) QueueSongsVisual

func (r *RecentlyPlayedView) QueueSongsVisual(start, end int, e *tcell.EventKey) *tcell.EventKey

func (*RecentlyPlayedView) RefreshState

func (r *RecentlyPlayedView) RefreshState()

func (RecentlyPlayedView) SetActions

func (d RecentlyPlayedView) SetActions(a map[string]*Action)

func (RecentlyPlayedView) SetMappings

func (d RecentlyPlayedView) SetMappings(m map[string]map[config.Key]string)

func (RecentlyPlayedView) SetVisualActions

func (d RecentlyPlayedView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

func (RecentlyPlayedView) VisualCapture

func (d RecentlyPlayedView) VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey

type Refreshable

type Refreshable interface {
	RefreshState()
}

type Root

type Root struct {
	*tview.Pages
	// contains filtered or unexported fields
}

func NewRoot

func NewRoot() *Root

func (*Root) AddCenteredWidget

func (m *Root) AddCenteredWidget(t CenteredWidget)

func (*Root) AfterContextClose

func (m *Root) AfterContextClose(f func())

func (*Root) Primitive

func (m *Root) Primitive(name string, t tview.Primitive)

type SearchContent

type SearchContent struct {
	URI  spotify.URI
	ID   spotify.ID
	Name string
	Type string
}

type SearchView

type SearchView struct {
	*DefaultViewNone
	// contains filtered or unexported fields
}

func NewSearchView

func NewSearchView() *SearchView

func (*SearchView) Content

func (a *SearchView) Content() func() [][]Content

func (SearchView) ExternalInputCapture

func (d SearchView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*SearchView) Name

func (a *SearchView) Name() string

func (*SearchView) OpenEntry

func (a *SearchView) OpenEntry()

func (*SearchView) PlayEntry

func (a *SearchView) PlayEntry()

func (*SearchView) RefreshState

func (a *SearchView) RefreshState()

func (SearchView) SetActions

func (d SearchView) SetActions(a map[string]*Action)

func (SearchView) SetMappings

func (d SearchView) SetMappings(m map[string]map[config.Key]string)

func (*SearchView) SetSearch

func (a *SearchView) SetSearch(s string)

func (SearchView) SetVisualActions

func (d SearchView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

type TopTracksView

type TopTracksView struct {
	*DefaultViewNone
	// contains filtered or unexported fields
}

func NewTopTracksView

func NewTopTracksView() *TopTracksView

func (*TopTracksView) Content

func (a *TopTracksView) Content() func() [][]Content

func (TopTracksView) ExternalInputCapture

func (d TopTracksView) ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey

func (*TopTracksView) Name

func (a *TopTracksView) Name() string

func (*TopTracksView) OpenEntry

func (a *TopTracksView) OpenEntry()

func (*TopTracksView) PlayEntry

func (a *TopTracksView) PlayEntry()

func (*TopTracksView) QueueEntry

func (a *TopTracksView) QueueEntry()

func (*TopTracksView) RefreshState

func (a *TopTracksView) RefreshState()

func (TopTracksView) SetActions

func (d TopTracksView) SetActions(a map[string]*Action)

func (TopTracksView) SetMappings

func (d TopTracksView) SetMappings(m map[string]map[config.Key]string)

func (TopTracksView) SetVisualActions

func (d TopTracksView) SetVisualActions(a map[string]func(start, end int, e *tcell.EventKey) *tcell.EventKey)

type View

type View interface {
	Content() func() [][]Content
	DisableVisualMode() bool
	ExternalInputCapture() func(e *tcell.EventKey) *tcell.EventKey
	VisualCapture() func(start, end int, e *tcell.EventKey) *tcell.EventKey
	Name() string
	OpenEntry()
}
var (
	CurrentView View
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL