app

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackMsg

type BackMsg struct{}

BackMsg requests navigation back to the previous screen.

type BookDetailLoadedMsg

type BookDetailLoadedMsg struct {
	ItemID string
	Item   *abs.LibraryItem
	Err    error
}

BookDetailLoadedMsg carries an enriched library item fetched from ABS.

type EpisodesLoadedMsg

type EpisodesLoadedMsg struct {
	ItemID   string
	Episodes []abs.PodcastEpisode
	Err      error
}

EpisodesLoadedMsg carries podcast episodes fetched from the API.

type KeyMap

type KeyMap struct {
	Quit           key.Binding
	Back           key.Binding
	Help           key.Binding
	ChapterOverlay key.Binding
	NextInQueue    key.Binding
	NextChapter    key.Binding
	PrevChapter    key.Binding
	SleepTimer     key.Binding
}

KeyMap defines the global keybindings for the root model.

func DefaultKeyMap

func DefaultKeyMap(cfg config.KeybindsConfig) KeyMap

DefaultKeyMap returns the default keybindings using the given config.

type Model

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

Model is the root application model that manages screen routing.

func New

func New(cfg config.Config, store *db.Store, client *abs.Client) Model

New creates a new root model. If client is non-nil (authenticated), the initial screen is Home; otherwise it starts at Login.

func NewWithPlayer

func NewWithPlayer(cfg config.Config, store *db.Store, client *abs.Client, mpv player.Player) Model

NewWithPlayer creates a new root model with a specific player implementation.

func (Model) ActiveScreen

func (m Model) ActiveScreen() Screen

ActiveScreen returns the currently active screen.

func (Model) BackStack

func (m Model) BackStack() []Screen

BackStack returns a copy of the current back stack.

func (Model) Cleanup

func (m Model) Cleanup()

Cleanup performs synchronous cleanup of playback resources.

func (Model) Init

func (m Model) Init() tea.Cmd

Init returns the initial command for the active screen.

func (Model) Queue

func (m Model) Queue() []QueueEntry

Queue returns a copy of the current playback queue.

func (Model) Update

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

Update dispatches messages to the active screen and handles navigation.

func (Model) View

func (m Model) View() string

View composes the header, error banner, active screen, and player footer.

type NavigateMsg struct {
	Screen Screen
}

NavigateMsg requests navigation to a different screen. Data carries optional context (e.g., a library item ID for detail view).

type PlaySessionData

type PlaySessionData struct {
	SessionID        string
	ItemID           string
	EpisodeID        string
	CurrentTime      float64
	Duration         float64
	Title            string
	Chapters         []abs.Chapter
	TrackStartOffset float64
	TrackDuration    float64
}

PlaySessionData carries the data returned from ABS when starting a session.

type PlaySessionMsg

type PlaySessionMsg struct {
	Session   PlaySessionData
	StreamURL string
	AuthToken string
}

PlaySessionMsg is sent after a play session is successfully started on ABS.

type PlaybackErrorMsg

type PlaybackErrorMsg struct {
	Err error
}

PlaybackErrorMsg carries an error from the playback lifecycle.

type PlaybackStoppedMsg

type PlaybackStoppedMsg struct{}

PlaybackStoppedMsg signals that playback cleanup is complete.

type PlayerReadyMsg

type PlayerReadyMsg struct{}

PlayerReadyMsg signals that mpv has been launched and connected.

type QueueEntry

type QueueEntry struct {
	Item    abs.LibraryItem
	Episode *abs.PodcastEpisode
}

QueueEntry represents a queued book or podcast episode.

type RestorePlaySessionMsg added in v0.1.1

type RestorePlaySessionMsg struct {
	PlaySessionMsg PlaySessionMsg
}

RestorePlaySessionMsg carries a restore-initiated play session that should launch paused.

type RestoreSessionMsg

type RestoreSessionMsg struct {
	Item           *abs.LibraryItem
	Episode        *abs.PodcastEpisode
	SavedEpisodeID string
}

RestoreSessionMsg carries the result of a session restore attempt. If Item is nil, no session was found or the restore failed — the app proceeds to the Home screen as usual.

type Screen

type Screen int

Screen represents a screen identifier in the application.

const (
	ScreenLogin Screen = iota
	ScreenHome
	ScreenLibrary
	ScreenDetail
	ScreenSearch
	ScreenSeriesList
	ScreenSeries
)

func (Screen) String

func (s Screen) String() string

String returns the display name for a screen.

type SleepTimerExpiredMsg

type SleepTimerExpiredMsg struct {
	Generation uint64
}

SleepTimerExpiredMsg fires when the sleep timer reaches zero.

type SyncTickMsg

type SyncTickMsg struct{}

SyncTickMsg fires every 30 seconds to sync playback progress with ABS.

Jump to

Keyboard shortcuts

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