components

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InspectorBorderHeight     = 2
	InspectorScrollIndicators = 2
)

Layout constants for inspector

View Source
const (
	// Border adds 1 char on each side (left+right for width, top+bottom for height)
	BorderWidth  = 2
	BorderHeight = 2

	// Scroll indicators ("↑ more" and "↓ more") each take 1 line
	ScrollIndicatorLines = 2
)

Layout constants for list columns

Variables

View Source
var (
	ListColumnKeys    = DefaultListColumnKeyMap()
	GlobalSearchKeys  = DefaultGlobalSearchKeyMap()
	PlaylistModalKeys = DefaultPlaylistModalKeyMap()
	SortModalKeys     = DefaultSortModalKeyMap()
)

Package-level key map instances

Functions

func WrapEpisodes

func WrapEpisodes(episodes []*domain.MediaItem) []domain.ListItem

WrapEpisodes converts a slice of *domain.MediaItem (episodes) to []domain.ListItem

func WrapLibraries

func WrapLibraries(libs []domain.Library) []domain.ListItem

WrapLibraries converts a slice of domain.Library to []domain.ListItem

func WrapMovies

func WrapMovies(movies []*domain.MediaItem) []domain.ListItem

WrapMovies converts a slice of *domain.MediaItem (movies) to []domain.ListItem

func WrapPlaylistItems

func WrapPlaylistItems(items []*domain.MediaItem) []domain.ListItem

WrapPlaylistItems converts a slice of *domain.MediaItem (playlist items) to []domain.ListItem

func WrapPlaylists

func WrapPlaylists(playlists []*domain.Playlist) []domain.ListItem

WrapPlaylists converts a slice of *domain.Playlist to []domain.ListItem

func WrapSeasons

func WrapSeasons(seasons []*domain.Season) []domain.ListItem

WrapSeasons converts a slice of *domain.Season to []domain.ListItem

func WrapShows

func WrapShows(shows []*domain.Show) []domain.ListItem

WrapShows converts a slice of *domain.Show to []domain.ListItem

Types

type ColumnType

type ColumnType int

ColumnType identifies the type of content in a column

const (
	ColumnTypeLibraries ColumnType = iota
	ColumnTypeMovies
	ColumnTypeShows
	ColumnTypeMixed // Mixed content (movies + shows)
	ColumnTypeSeasons
	ColumnTypeEpisodes
	ColumnTypePlaylists
	ColumnTypePlaylistItems
	ColumnTypeSeasonEpisodes // Collapsible seasons + episodes (Tab 3 for TV shows)
)

type GlobalSearch

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

GlobalSearch is the fuzzy search modal component

func NewGlobalSearch

func NewGlobalSearch() GlobalSearch

NewGlobalSearch creates a new global search component

func (*GlobalSearch) Hide

func (o *GlobalSearch) Hide()

Hide hides the global search

func (GlobalSearch) Init

func (o GlobalSearch) Init() tea.Cmd

Init initializes the component

func (GlobalSearch) IsVisible

func (o GlobalSearch) IsVisible() bool

IsVisible returns true if the global search is visible

func (GlobalSearch) Query

func (o GlobalSearch) Query() string

Query returns the current search query

func (*GlobalSearch) QueryChanged

func (o *GlobalSearch) QueryChanged() bool

QueryChanged returns true if the query changed since last check and updates prevQuery

func (GlobalSearch) ResultCount

func (o GlobalSearch) ResultCount() int

ResultCount returns the number of results

func (GlobalSearch) Selected

func (o GlobalSearch) Selected() *search.FilterItem

Selected returns the selected result's FilterItem

func (*GlobalSearch) SetResults

func (o *GlobalSearch) SetResults(results []search.FilterResult)

SetResults sets the search results with match highlighting data

func (*GlobalSearch) SetSize

func (o *GlobalSearch) SetSize(width, height int)

SetSize updates the component dimensions

func (*GlobalSearch) Show

func (o *GlobalSearch) Show()

Show makes the global search visible and focuses the input

func (GlobalSearch) Update

func (o GlobalSearch) Update(msg tea.Msg) (GlobalSearch, tea.Cmd, bool)

Update handles messages

func (GlobalSearch) View

func (o GlobalSearch) View() string

View renders the component

type GlobalSearchKeyMap

type GlobalSearchKeyMap struct {
	Escape key.Binding
	Enter  key.Binding
	Up     key.Binding
	Down   key.Binding
}

GlobalSearchKeyMap defines key bindings for the global search component

func DefaultGlobalSearchKeyMap

func DefaultGlobalSearchKeyMap() GlobalSearchKeyMap

DefaultGlobalSearchKeyMap returns the default global search key bindings

type InputModal

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

InputModal is a simple text input modal

func NewInputModal

func NewInputModal() InputModal

NewInputModal creates a new input modal

func (*InputModal) Hide

func (m *InputModal) Hide()

Hide dismisses the modal

func (InputModal) IsVisible

func (m InputModal) IsVisible() bool

IsVisible returns whether the modal is shown

func (*InputModal) Show

func (m *InputModal) Show(title string)

Show displays the modal with a title

func (InputModal) Update

func (m InputModal) Update(msg tea.Msg) (InputModal, tea.Cmd, bool)

Update handles input events, returns (modal, cmd, submitted)

func (InputModal) Value

func (m InputModal) Value() string

Value returns the current input value

func (InputModal) View

func (m InputModal) View() string

View renders the input modal

type Inspector

type Inspector struct {
	Focused bool
	// contains filtered or unexported fields
}

Inspector displays detailed metadata for the selected item

func NewInspector

func NewInspector() Inspector

NewInspector creates a new inspector component

func (Inspector) HasItem

func (i Inspector) HasItem() bool

HasItem returns true if there is an item to display

func (*Inspector) SetItem

func (i *Inspector) SetItem(item interface{})

SetItem sets the item to display

func (*Inspector) SetLibraryStates

func (i *Inspector) SetLibraryStates(states map[string]LibrarySyncState)

SetLibraryStates sets the library sync states for displaying item counts

func (*Inspector) SetSize

func (i *Inspector) SetSize(width, height int)

SetSize updates the component dimensions

func (Inspector) Update

func (i Inspector) Update(msg tea.Msg) (Inspector, tea.Cmd)

Update handles scrolling when focused

func (Inspector) View

func (i Inspector) View() string

View renders the component

type LibraryStatus

type LibraryStatus int

LibraryStatus represents the sync status of a library

const (
	StatusIdle LibraryStatus = iota
	StatusSyncing
	StatusSynced
	StatusError
)

type LibrarySyncState

type LibrarySyncState struct {
	Status    LibraryStatus
	Loaded    int   // Items loaded so far
	Total     int   // Total items expected
	FromCache bool  // Whether loaded from cache
	Error     error // Error if any
}

LibrarySyncState tracks sync progress for a single library

type ListColumn

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

ListColumn is a scrollable list column that can display various content types. It implements the Column interface.

func NewLibraryColumn

func NewLibraryColumn(libraries []domain.Library) *ListColumn

NewLibraryColumn creates a column for displaying libraries

func NewListColumn

func NewListColumn(colType ColumnType, title string) *ListColumn

NewListColumn creates a new list column with the given type and title

func (*ListColumn) AddSeasonEpisodes added in v1.0.0

func (c *ListColumn) AddSeasonEpisodes(seasonID string, eps []*domain.MediaItem)

AddSeasonEpisodes inserts loaded episodes into the matching season group and rebuilds.

func (*ListColumn) ApplySort

func (c *ListColumn) ApplySort(field SortField, dir SortDirection)

ApplySort sets the sort field and direction, rebuilds sortedIdx, and resets view

func (*ListColumn) CanDrillInto

func (c *ListColumn) CanDrillInto() bool

func (*ListColumn) ClearFilter

func (c *ListColumn) ClearFilter()

ClearFilter deactivates the filter and shows all items

func (*ListColumn) ColumnType

func (c *ListColumn) ColumnType() ColumnType

ColumnType returns the column's content type

func (*ListColumn) ContentID

func (c *ListColumn) ContentID() string

ContentID returns the content identity for this column

func (*ListColumn) ExpandFirstSeason added in v1.0.0

func (c *ListColumn) ExpandFirstSeason() (needsLoad bool, seasonID string)

ExpandFirstSeason expands the first not completely watched season group. Returns (needsLoad, seasonID) — caller issues LoadEpisodesCmd when needsLoad is true.

func (*ListColumn) FindIndexByID

func (c *ListColumn) FindIndexByID(id string) int

FindIndexByID finds the index of an item by its ID. Returns -1 if not found.

func (*ListColumn) GetSeasonPlaylist added in v1.1.0

func (c *ListColumn) GetSeasonPlaylist() (playlist []domain.MediaItem, selectedIdx int)

GetSeasonPlaylist returns all MediaItems in the current season (ignoring filters) and the index of the selected item.

func (*ListColumn) Height

func (c *ListColumn) Height() int

func (*ListColumn) Inspector added in v1.1.1

func (c *ListColumn) Inspector() *Inspector

func (*ListColumn) IsEmpty

func (c *ListColumn) IsEmpty() bool

func (*ListColumn) IsFilterTyping

func (c *ListColumn) IsFilterTyping() bool

IsFilterTyping returns true if filter is active AND input is focused

func (*ListColumn) IsFiltering

func (c *ListColumn) IsFiltering() bool

IsFiltering returns true if filter mode is active

func (*ListColumn) IsFocused

func (c *ListColumn) IsFocused() bool

func (*ListColumn) IsLoading

func (c *ListColumn) IsLoading() bool

func (*ListColumn) ItemCount

func (c *ListColumn) ItemCount() int

func (*ListColumn) Items added in v1.0.0

func (c *ListColumn) Items() []domain.ListItem

Items returns the current items in the column

func (*ListColumn) SelectedIndex

func (c *ListColumn) SelectedIndex() int

func (*ListColumn) SelectedItem

func (c *ListColumn) SelectedItem() interface{}

func (*ListColumn) SelectedLibrary

func (c *ListColumn) SelectedLibrary() *domain.Library

SelectedLibrary returns the selected library (if in library column)

func (*ListColumn) SelectedMediaItem

func (c *ListColumn) SelectedMediaItem() *domain.MediaItem

SelectedMediaItem returns the selected media item (if in movies/episodes/playlist items/mixed column)

func (*ListColumn) SelectedPlaylist

func (c *ListColumn) SelectedPlaylist() *domain.Playlist

SelectedPlaylist returns the selected playlist (if in playlists column)

func (*ListColumn) SelectedSeason

func (c *ListColumn) SelectedSeason() *domain.Season

SelectedSeason returns the selected season (if in seasons column)

func (*ListColumn) SelectedSeasonHeader added in v1.0.0

func (c *ListColumn) SelectedSeasonHeader() *SeasonHeader

SelectedSeasonHeader returns the SeasonHeader under the cursor, or nil.

func (*ListColumn) SelectedShow

func (c *ListColumn) SelectedShow() *domain.Show

SelectedShow returns the selected show (if in shows column)

func (*ListColumn) SetContentID

func (c *ListColumn) SetContentID(id string)

SetContentID sets the content identity for race condition prevention

func (*ListColumn) SetFocused

func (c *ListColumn) SetFocused(focused bool)

func (*ListColumn) SetHideWatched added in v1.1.0

func (c *ListColumn) SetHideWatched(hide bool)

SetHideWatched sets whether to hide watched items from the list

func (*ListColumn) SetInspectorFocused added in v1.1.1

func (c *ListColumn) SetInspectorFocused(focused bool)

func (*ListColumn) SetItems

func (c *ListColumn) SetItems(rawItems interface{})

SetItems updates the items in the column and preserves selection if possible

func (*ListColumn) SetLibraryStates

func (c *ListColumn) SetLibraryStates(states map[string]LibrarySyncState)

SetLibraryStates updates the library sync states (for library column)

func (*ListColumn) SetLoading

func (c *ListColumn) SetLoading(loading bool)

func (*ListColumn) SetSeasonGroups added in v1.0.0

func (c *ListColumn) SetSeasonGroups(groups []SeasonGroup)

SetSeasonGroups replaces all season groups and rebuilds the visible item list.

func (*ListColumn) SetSelectedByID

func (c *ListColumn) SetSelectedByID(id string) bool

SetSelectedByID finds an item by ID and selects it. Returns true on success.

func (*ListColumn) SetSelectedIndex

func (c *ListColumn) SetSelectedIndex(idx int)

func (*ListColumn) SetShowLibraryCounts

func (c *ListColumn) SetShowLibraryCounts(show bool)

SetShowLibraryCounts sets whether to keep library item counts visible after sync

func (*ListColumn) SetShowWatchStatus

func (c *ListColumn) SetShowWatchStatus(show bool)

SetShowWatchStatus sets whether to display watch status indicators

func (*ListColumn) SetSize

func (c *ListColumn) SetSize(width, height int)

func (*ListColumn) SetSpinnerFrame

func (c *ListColumn) SetSpinnerFrame(frame int)

SetSpinnerFrame updates the spinner animation frame

func (*ListColumn) SortState

func (c *ListColumn) SortState() (SortField, SortDirection)

SortState returns the current sort field and direction

func (*ListColumn) Title

func (c *ListColumn) Title() string

func (*ListColumn) ToggleFilter

func (c *ListColumn) ToggleFilter()

ToggleFilter activates the filter input

func (*ListColumn) ToggleSelectedSeason added in v1.0.0

func (c *ListColumn) ToggleSelectedSeason() (needsLoad bool, seasonID string)

ToggleSelectedSeason toggles the expand/collapse state of the currently selected season header. Returns (needsLoad, seasonID) — caller issues LoadEpisodesCmd when needsLoad is true.

func (*ListColumn) Update

func (c *ListColumn) Update(msg tea.Msg) (*ListColumn, tea.Cmd)

func (*ListColumn) View

func (c *ListColumn) View() string

func (*ListColumn) Width

func (c *ListColumn) Width() int

type ListColumnKeyMap

type ListColumnKeyMap struct {
	Up       key.Binding
	Down     key.Binding
	Home     key.Binding
	End      key.Binding
	HalfUp   key.Binding
	HalfDown key.Binding
	PageUp   key.Binding
	PageDown key.Binding
	Escape   key.Binding
	Enter    key.Binding
	Filter   key.Binding
}

ListColumnKeyMap defines key bindings for list column navigation

func DefaultListColumnKeyMap

func DefaultListColumnKeyMap() ListColumnKeyMap

DefaultListColumnKeyMap returns the default list column key bindings

type PlaylistChange

type PlaylistChange struct {
	PlaylistID string
	Add        bool // true = add to playlist, false = remove from playlist
}

PlaylistChange represents a pending change to playlist membership

type PlaylistModal

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

PlaylistModal is a modal for managing playlist membership

func NewPlaylistModal

func NewPlaylistModal() PlaylistModal

NewPlaylistModal creates a new playlist modal

func (*PlaylistModal) GetChanges

func (m *PlaylistModal) GetChanges() []PlaylistChange

GetChanges returns the list of changes to apply (added/removed playlists)

func (*PlaylistModal) HandleKeyMsg

func (m *PlaylistModal) HandleKeyMsg(msg tea.KeyMsg) (handled bool, shouldClose bool, shouldCreate bool)

HandleKeyMsg processes a key message, returns (handled, shouldClose, shouldCreate)

func (*PlaylistModal) Hide

func (m *PlaylistModal) Hide()

Hide dismisses the modal

func (*PlaylistModal) IsCreateMode

func (m *PlaylistModal) IsCreateMode() bool

IsCreateMode returns whether we're creating a new playlist

func (*PlaylistModal) IsVisible

func (m *PlaylistModal) IsVisible() bool

IsVisible returns whether the modal is shown

func (*PlaylistModal) Item

func (m *PlaylistModal) Item() *domain.MediaItem

Item returns the media item being managed

func (*PlaylistModal) NewPlaylistTitle

func (m *PlaylistModal) NewPlaylistTitle() string

NewPlaylistTitle returns the title entered for new playlist creation

func (*PlaylistModal) SetSize

func (m *PlaylistModal) SetSize(width, height int)

SetSize sets the modal dimensions

func (*PlaylistModal) Show

func (m *PlaylistModal) Show(playlists []*domain.Playlist, membership map[string]bool, item *domain.MediaItem)

Show displays the modal with the given playlists and item

func (*PlaylistModal) View

func (m *PlaylistModal) View() string

View renders the playlist modal

type PlaylistModalKeyMap

type PlaylistModalKeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Toggle key.Binding
	Create key.Binding
	Enter  key.Binding
	Escape key.Binding
}

PlaylistModalKeyMap defines key bindings for the playlist modal

func DefaultPlaylistModalKeyMap

func DefaultPlaylistModalKeyMap() PlaylistModalKeyMap

DefaultPlaylistModalKeyMap returns the default playlist modal key bindings

type SeasonGroup added in v1.0.0

type SeasonGroup struct {
	Header   *SeasonHeader
	Episodes []*domain.MediaItem
	Loaded   bool
}

SeasonGroup pairs a SeasonHeader with its lazily-loaded episodes.

type SeasonHeader added in v1.0.0

type SeasonHeader struct {
	Season   *domain.Season
	Expanded bool
	Loading  bool
}

SeasonHeader is a collapsible section header inside a ColumnTypeSeasonEpisodes column. It represents one season and can be expanded to reveal its episodes.

func (*SeasonHeader) CanDrillDown added in v1.0.0

func (h *SeasonHeader) CanDrillDown() bool

func (*SeasonHeader) GetAddedAt added in v1.0.0

func (h *SeasonHeader) GetAddedAt() int64

func (*SeasonHeader) GetDescription added in v1.0.0

func (h *SeasonHeader) GetDescription() string

func (*SeasonHeader) GetDuration added in v1.0.0

func (h *SeasonHeader) GetDuration() time.Duration

func (*SeasonHeader) GetID added in v1.0.0

func (h *SeasonHeader) GetID() string

func (*SeasonHeader) GetItemType added in v1.0.0

func (h *SeasonHeader) GetItemType() string

func (*SeasonHeader) GetLibraryID added in v1.0.3

func (h *SeasonHeader) GetLibraryID() string

func (*SeasonHeader) GetRating added in v1.0.0

func (h *SeasonHeader) GetRating() float64

func (*SeasonHeader) GetSortTitle added in v1.0.0

func (h *SeasonHeader) GetSortTitle() string

func (*SeasonHeader) GetTitle added in v1.0.0

func (h *SeasonHeader) GetTitle() string

func (*SeasonHeader) GetUpdatedAt added in v1.0.0

func (h *SeasonHeader) GetUpdatedAt() int64

func (*SeasonHeader) GetWatchStatus added in v1.0.0

func (h *SeasonHeader) GetWatchStatus() domain.WatchStatus

func (*SeasonHeader) GetYear added in v1.0.0

func (h *SeasonHeader) GetYear() int

type SortDirection

type SortDirection int

SortDirection represents sort direction

const (
	SortAsc SortDirection = iota
	SortDesc
)

func DefaultDirection

func DefaultDirection(field SortField) SortDirection

DefaultDirection returns the default sort direction for a field

type SortField

type SortField int

SortField represents a field to sort by

const (
	SortDefault SortField = iota
	SortTitle
	SortDateAdded
	SortLastUpdated // shows only
	SortReleased
	SortDuration
	SortRating
	SortEpisodeNum
)

func EpisodeSortOptions

func EpisodeSortOptions() []SortField

EpisodeSortOptions returns the available sort options for episodes

func MixedSortOptions

func MixedSortOptions() []SortField

MixedSortOptions returns the available sort options for mixed content

func MovieSortOptions

func MovieSortOptions() []SortField

MovieSortOptions returns the available sort options for movies

func ShowSortOptions

func ShowSortOptions() []SortField

ShowSortOptions returns the available sort options for shows

func (SortField) String

func (f SortField) String() string

String returns the display name for the sort field

type SortModal

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

SortModal is a small popup for choosing sort order

func (*SortModal) HandleKeyMsg

func (m *SortModal) HandleKeyMsg(msg tea.KeyMsg) (handled bool, selection *SortSelection)

HandleKeyMsg processes a key press, returns (handled, selection). If selection is non-nil, the user confirmed a choice.

func (*SortModal) Hide

func (m *SortModal) Hide()

Hide dismisses the modal

func (SortModal) IsVisible

func (m SortModal) IsVisible() bool

IsVisible returns whether the modal is shown

func (*SortModal) Show

func (m *SortModal) Show(options []SortField, activeField SortField, activeDir SortDirection)

Show displays the modal with the given options and current sort state

func (SortModal) View

func (m SortModal) View() string

View renders the sort modal

type SortModalKeyMap

type SortModalKeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Left   key.Binding
	Right  key.Binding
	Enter  key.Binding
	Escape key.Binding
	Close  key.Binding
}

SortModalKeyMap defines key bindings for the sort modal

func DefaultSortModalKeyMap

func DefaultSortModalKeyMap() SortModalKeyMap

DefaultSortModalKeyMap returns the default sort modal key bindings

type SortSelection

type SortSelection struct {
	Field     SortField
	Direction SortDirection
}

SortSelection represents the user's sort choice

Jump to

Keyboard shortcuts

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