tui

package
v0.3.2-sonosh.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHelperHUDConfigPath

func DefaultHelperHUDConfigPath() (string, error)

func DefaultLastRoomConfigPath

func DefaultLastRoomConfigPath() (string, error)

func DefaultLayoutConfigPath

func DefaultLayoutConfigPath() (string, error)

func DefaultPlaylistCarouselConfigPath

func DefaultPlaylistCarouselConfigPath() (string, error)

func DefaultThemeConfigPath

func DefaultThemeConfigPath() (string, error)

func LoadCompactLayout

func LoadCompactLayout(path string) (bool, error)

func LoadHelperHUDEnabled

func LoadHelperHUDEnabled(path string) (bool, error)

func LoadLastRoomSelection

func LoadLastRoomSelection(path string) (lastRoomSelection, error)

func LoadPlaylistCarouselStore

func LoadPlaylistCarouselStore(path string) (playlistCarouselStore, error)

func LoadThemeName

func LoadThemeName(path string) (string, error)

func SaveCompactLayout

func SaveCompactLayout(path string, compact bool) error

func SaveHelperHUDConfig

func SaveHelperHUDConfig(path string, cfg HelperHUDConfig) error

func SaveHelperHUDEnabled

func SaveHelperHUDEnabled(path string, enabled bool) error

func SaveLastRoomSelection

func SaveLastRoomSelection(path string, selection lastRoomSelection) error

func SavePlaylistCarouselStore

func SavePlaylistCarouselStore(path string, store playlistCarouselStore) error

func SaveThemeName

func SaveThemeName(path, theme string) error

Types

type Backend

type Backend interface {
	Discover(context.Context) ([]Room, error)
	Status(context.Context, Room) (Status, error)
	Transport(context.Context, Room, string) error
	SetVolume(context.Context, Room, int) error
	ToggleMute(context.Context, Room) error
	ToggleCrossfade(context.Context, Room) (bool, error)
	ToggleShuffle(context.Context, Room) (bool, error)
	ToggleRepeat(context.Context, Room) (string, error)
	Scrub(context.Context, Room, string, string, int) (string, error)
	Queue(context.Context, Room, int, int) (QueuePage, error)
	PlayQueuePosition(context.Context, Room, int) error
	RemoveQueuePosition(context.Context, Room, int) error
	ClearQueue(context.Context, Room) error
	MoveQueuePosition(context.Context, Room, int, int) error
	Search(context.Context, Room, string, string, string, int) ([]SearchResult, error)
	PlaylistShelf(context.Context, Room, string, string, int) ([]SearchResult, error)
	ResolvePinnedPlaylist(context.Context, Room, string, string) (SearchResult, bool, error)
	BrowsePlaylist(context.Context, Room, string, SearchResult, int) ([]SearchResult, error)
	PlaySearchResult(context.Context, Room, string, SearchResult) error
}

type Config

type Config struct {
	Timeout             time.Duration
	SearchService       string
	SearchCategory      string
	SearchLimit         int
	MacHelperPath       string
	HelperHUDEnabled    bool
	HelperHUDPosition   string
	HelperHUDConfigPath string
	Theme               string
	ThemeConfigPath     string
	Compact             bool
	LayoutConfigPath    string
	CarouselPath        string
	LastRoomConfigPath  string
}

type HelperHUDConfig

type HelperHUDConfig struct {
	Enabled  bool
	Position string
}

func DefaultHelperHUDConfig

func DefaultHelperHUDConfig() HelperHUDConfig

func LoadHelperHUDConfig

func LoadHelperHUDConfig(path string) (HelperHUDConfig, error)

type Model

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

func NewModel

func NewModel(backend Backend, cfg Config) Model

func (Model) Close

func (m Model) Close() error

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type QueueItem

type QueueItem struct {
	Position int
	Title    string
	Artist   string
	Album    string
	URI      string
}

type QueuePage

type QueuePage struct {
	Items          []QueueItem
	NumberReturned int
	TotalMatches   int
	UpdateID       int
}

type Room

type Room struct {
	Name          string
	IP            string
	CoordinatorIP string
	GroupMembers  []string
}

type SearchResult

type SearchResult struct {
	Item sonos.SMAPIItem
}

func (SearchResult) Title

func (r SearchResult) Title() string

type SonosBackend

type SonosBackend struct {
	Timeout time.Duration
}

func NewSonosBackend

func NewSonosBackend(timeout time.Duration) *SonosBackend

func (*SonosBackend) BrowsePlaylist

func (b *SonosBackend) BrowsePlaylist(ctx context.Context, room Room, serviceName string, result SearchResult, limit int) ([]SearchResult, error)

func (*SonosBackend) ClearQueue

func (b *SonosBackend) ClearQueue(ctx context.Context, room Room) error

func (*SonosBackend) Discover

func (b *SonosBackend) Discover(ctx context.Context) ([]Room, error)

func (*SonosBackend) MoveQueuePosition

func (b *SonosBackend) MoveQueuePosition(ctx context.Context, room Room, fromPosition, toPosition int) error

func (*SonosBackend) PlayQueuePosition

func (b *SonosBackend) PlayQueuePosition(ctx context.Context, room Room, position int) error

func (*SonosBackend) PlaySearchResult

func (b *SonosBackend) PlaySearchResult(ctx context.Context, room Room, serviceName string, result SearchResult) error

func (*SonosBackend) PlaylistShelf

func (b *SonosBackend) PlaylistShelf(ctx context.Context, room Room, serviceName, shelfID string, limit int) ([]SearchResult, error)

func (*SonosBackend) Queue

func (b *SonosBackend) Queue(ctx context.Context, room Room, start, count int) (QueuePage, error)

func (*SonosBackend) RemoveQueuePosition

func (b *SonosBackend) RemoveQueuePosition(ctx context.Context, room Room, position int) error

func (*SonosBackend) ResolvePinnedPlaylist

func (b *SonosBackend) ResolvePinnedPlaylist(ctx context.Context, room Room, serviceName, title string) (SearchResult, bool, error)

func (*SonosBackend) Scrub

func (b *SonosBackend) Scrub(ctx context.Context, room Room, position, duration string, deltaSeconds int) (string, error)

func (*SonosBackend) Search

func (b *SonosBackend) Search(ctx context.Context, room Room, serviceName, category, query string, limit int) ([]SearchResult, error)

func (*SonosBackend) SetVolume

func (b *SonosBackend) SetVolume(ctx context.Context, room Room, volume int) error

func (*SonosBackend) Status

func (b *SonosBackend) Status(ctx context.Context, room Room) (Status, error)

func (*SonosBackend) ToggleCrossfade

func (b *SonosBackend) ToggleCrossfade(ctx context.Context, room Room) (bool, error)

func (*SonosBackend) ToggleMute

func (b *SonosBackend) ToggleMute(ctx context.Context, room Room) error

func (*SonosBackend) ToggleRepeat

func (b *SonosBackend) ToggleRepeat(ctx context.Context, room Room) (string, error)

func (*SonosBackend) ToggleShuffle

func (b *SonosBackend) ToggleShuffle(ctx context.Context, room Room) (bool, error)

func (*SonosBackend) Transport

func (b *SonosBackend) Transport(ctx context.Context, room Room, action string) error

type Status

type Status struct {
	State            string
	Title            string
	Artist           string
	Album            string
	AlbumArt         string
	Position         string
	Duration         string
	Volume           int
	Muted            bool
	CrossfadeEnabled bool
	CrossfadeKnown   bool
	ShuffleEnabled   bool
	ShuffleKnown     bool
	RepeatMode       string
	RepeatKnown      bool
	QueuePosition    int
}

Jump to

Keyboard shortcuts

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