Documentation
¶
Index ¶
- Variables
- type Library
- func (l *Library) CanDrillDown() bool
- func (l *Library) GetAddedAt() int64
- func (l *Library) GetDescription() string
- func (l *Library) GetDuration() time.Duration
- func (l *Library) GetID() string
- func (l *Library) GetItemType() string
- func (l *Library) GetLibraryID() string
- func (l *Library) GetRating() float64
- func (l *Library) GetSortTitle() string
- func (l *Library) GetTitle() string
- func (l *Library) GetUpdatedAt() int64
- func (l *Library) GetWatchStatus() WatchStatus
- func (l *Library) GetYear() int
- type LibraryClient
- type ListItem
- type MediaItem
- func (m *MediaItem) CanDrillDown() bool
- func (m MediaItem) ChannelLayout() string
- func (m MediaItem) EpisodeCode() string
- func (m MediaItem) FormattedDuration() string
- func (m MediaItem) FormattedFileSize() string
- func (m *MediaItem) GetAddedAt() int64
- func (m *MediaItem) GetDescription() string
- func (m *MediaItem) GetDuration() time.Duration
- func (m *MediaItem) GetID() string
- func (m *MediaItem) GetItemType() string
- func (m *MediaItem) GetLibraryID() string
- func (m *MediaItem) GetRating() float64
- func (m *MediaItem) GetSortTitle() string
- func (m *MediaItem) GetTitle() string
- func (m *MediaItem) GetUpdatedAt() int64
- func (m *MediaItem) GetWatchStatus() WatchStatus
- func (m *MediaItem) GetYear() int
- func (m MediaItem) Resolution() string
- func (m MediaItem) ShouldResume() bool
- func (m MediaItem) WatchStatus() WatchStatus
- type MediaType
- type PlayableMedia
- type PlaybackClient
- type Playlist
- func (p *Playlist) CanDrillDown() bool
- func (p *Playlist) GetAddedAt() int64
- func (p *Playlist) GetDescription() string
- func (p *Playlist) GetDuration() time.Duration
- func (p *Playlist) GetID() string
- func (p *Playlist) GetItemType() string
- func (p *Playlist) GetLibraryID() string
- func (p *Playlist) GetRating() float64
- func (p *Playlist) GetSortTitle() string
- func (p *Playlist) GetTitle() string
- func (p *Playlist) GetUpdatedAt() int64
- func (p *Playlist) GetWatchStatus() WatchStatus
- func (p *Playlist) GetYear() int
- type PlaylistClient
- type ProgressFunc
- type SearchClient
- type Season
- func (s *Season) CanDrillDown() bool
- func (s Season) DisplayTitle() string
- func (s *Season) GetAddedAt() int64
- func (s *Season) GetDescription() string
- func (s *Season) GetDuration() time.Duration
- func (s *Season) GetID() string
- func (s *Season) GetItemType() string
- func (s *Season) GetLibraryID() string
- func (s *Season) GetRating() float64
- func (s *Season) GetSortTitle() string
- func (s *Season) GetTitle() string
- func (s *Season) GetUpdatedAt() int64
- func (s *Season) GetWatchStatus() WatchStatus
- func (s *Season) GetYear() int
- func (s Season) WatchStatus() WatchStatus
- type Show
- func (s *Show) CanDrillDown() bool
- func (s *Show) GetAddedAt() int64
- func (s *Show) GetDescription() string
- func (s *Show) GetDuration() time.Duration
- func (s *Show) GetID() string
- func (s *Show) GetItemType() string
- func (s *Show) GetLibraryID() string
- func (s *Show) GetRating() float64
- func (s *Show) GetSortTitle() string
- func (s *Show) GetTitle() string
- func (s *Show) GetUpdatedAt() int64
- func (s *Show) GetWatchStatus() WatchStatus
- func (s *Show) GetYear() int
- func (s Show) WatchStatus() WatchStatus
- type Store
- type Subtitle
- type SyncResult
- type WatchStatus
Constants ¶
This section is empty.
Variables ¶
var ( // ErrItemNotFound indicates the requested media item does not exist ErrItemNotFound = errors.New("media item not found") // ErrServerOffline indicates the media server is unreachable ErrServerOffline = errors.New("media server is unreachable") // ErrAuthFailed indicates authentication failed ErrAuthFailed = errors.New("authentication token is invalid") )
Sentinel errors for domain operations
Functions ¶
This section is empty.
Types ¶
type Library ¶
type Library struct {
ID string // Server-specific unique identifier
Name string // Display name
Type string // "movie" or "show"
UpdatedAt int64 // Server's contentChangedAt timestamp
}
Library represents a media server library section
func (*Library) CanDrillDown ¶
func (*Library) GetAddedAt ¶
func (*Library) GetDescription ¶
func (*Library) GetDuration ¶
func (*Library) GetItemType ¶
func (*Library) GetLibraryID ¶ added in v1.0.3
func (*Library) GetSortTitle ¶
func (*Library) GetUpdatedAt ¶
func (*Library) GetWatchStatus ¶
func (l *Library) GetWatchStatus() WatchStatus
type LibraryClient ¶
type LibraryClient interface {
GetLibraries(ctx context.Context) ([]Library, error)
GetMovies(ctx context.Context, libID string, offset, limit int) ([]*MediaItem, int, error)
GetShows(ctx context.Context, libID string, offset, limit int) ([]*Show, int, error)
GetMixedContent(ctx context.Context, libID string, offset, limit int) ([]ListItem, int, error)
GetSeasons(ctx context.Context, showID string) ([]*Season, error)
GetEpisodes(ctx context.Context, seasonID string) ([]*MediaItem, error)
GetContinueWatching(ctx context.Context) ([]*MediaItem, error)
}
LibraryClient provides network operations for library browsing.
type ListItem ¶
type ListItem interface {
// GetID returns the unique identifier for this item
GetID() string
// GetLibraryID returns the parent library ID
GetLibraryID() string
// GetTitle returns the display title
GetTitle() string
// GetSortTitle returns the title used for alphabetical sorting (handles "The", "A", etc.)
GetSortTitle() string
// GetYear returns the release/air year (0 if not applicable)
GetYear() int
// GetDescription returns secondary info for display (e.g., "2024" for movies, "3 Seasons" for shows)
GetDescription() string
// GetItemType returns the type identifier: "movie", "show", "season", "episode"
GetItemType() string
// GetWatchStatus returns the watch status for indicator rendering
GetWatchStatus() WatchStatus
// CanDrillDown returns true if this item can be drilled into (shows child content)
CanDrillDown() bool
// GetAddedAt returns the unix timestamp when added to library (0 if not applicable)
GetAddedAt() int64
// GetUpdatedAt returns the unix timestamp when last updated (0 if not applicable)
GetUpdatedAt() int64
// GetDuration returns the duration (0 if not applicable)
GetDuration() time.Duration
// GetRating returns the audience/community rating 0-10 (0 if not applicable)
GetRating() float64
}
ListItem is the polymorphic interface for items that can be displayed in lists. It provides a common API for display, filtering, and sorting across all content types. Domain entities (MediaItem, Show, Season) implement this interface directly.
type MediaItem ¶
type MediaItem struct {
ID string // Server-specific unique identifier
Title string // Display title
SortTitle string // Title used for sorting
LibraryID string // Parent library ID
Summary string // Plot synopsis
Year int // Release year
AddedAt int64 // Unix timestamp when added to library
UpdatedAt int64 // Unix timestamp when last updated
Duration time.Duration // Total runtime
ViewOffset time.Duration // Watch progress
IsPlayed bool // Whether item is marked as watched
Type MediaType // Movie or Episode
// Episode-specific fields (empty for movies)
ShowTitle string // Parent show name
ShowID string // Parent show ID (for navigation)
SeasonNum int // Season number (0 = specials)
EpisodeNum int // Episode number within season
ParentID string // Season ID (for navigation)
// Rating (0-10 scale, audience/community rating)
Rating float64
// Content rating (e.g., "PG-13", "R", "TV-MA")
ContentRating string
// Technical metadata
AirDate string // Full release/air date (e.g. "2023-10-25")
FileSize int64 // File size in bytes
Bitrate int // Bitrate in kbps
Width int // Video width in pixels
Height int // Video height in pixels
VideoCodec string // Normalized: "HEVC", "H.264", "AV1"
AudioCodec string // Normalized: "AAC", "AC3", "DTS"
AudioChannels int // Channel count: 2, 6, 8
Container string // "mkv", "mp4"
// Image URLs
ThumbURL string // Poster/thumbnail image URL
ArtURL string // Background art URL
}
MediaItem represents a playable item (Movie or Episode)
func (*MediaItem) CanDrillDown ¶
func (MediaItem) ChannelLayout ¶
ChannelLayout returns the audio channel layout as a string
func (MediaItem) EpisodeCode ¶
EpisodeCode returns the formatted episode code (e.g., "S01E05")
func (MediaItem) FormattedDuration ¶
FormattedDuration returns the duration in a human-readable format
func (MediaItem) FormattedFileSize ¶
FormattedFileSize returns the file size in a human-readable format
func (*MediaItem) GetAddedAt ¶
func (*MediaItem) GetDescription ¶
func (*MediaItem) GetDuration ¶
func (*MediaItem) GetItemType ¶
func (*MediaItem) GetLibraryID ¶ added in v1.0.3
func (*MediaItem) GetSortTitle ¶
func (*MediaItem) GetUpdatedAt ¶
func (*MediaItem) GetWatchStatus ¶
func (m *MediaItem) GetWatchStatus() WatchStatus
func (MediaItem) Resolution ¶
Resolution returns a human-readable resolution string based on video width and height
func (MediaItem) ShouldResume ¶
ShouldResume returns true if playback should resume from saved position
func (MediaItem) WatchStatus ¶
func (m MediaItem) WatchStatus() WatchStatus
WatchStatus returns the watch status of the media item
type PlayableMedia ¶ added in v1.0.1
PlayableMedia describes everything the player needs to play an item: the main media URL plus any external (sidecar) subtitle tracks the server exposes.
type PlaybackClient ¶
type PlaybackClient interface {
ResolvePlayable(ctx context.Context, itemID string) (PlayableMedia, error)
MarkPlayed(ctx context.Context, itemID string) error
MarkUnplayed(ctx context.Context, itemID string) error
// UpdateProgress reports the current playback position to the server.
// positionMs is the current position in milliseconds.
UpdateProgress(ctx context.Context, itemID string, positionMs int64) error
}
PlaybackClient provides network operations for media playback.
type Playlist ¶
type Playlist struct {
ID string // Playlist identifier
Title string // Display title
PlaylistType string // "video", "audio", "photo"
Smart bool // Smart/dynamic playlist
ItemCount int // Number of items in playlist
Duration time.Duration // Total duration of all items
UpdatedAt int64 // Unix timestamp when last updated
}
Playlist represents a user-created playlist
func (*Playlist) CanDrillDown ¶
func (*Playlist) GetAddedAt ¶
func (*Playlist) GetDescription ¶
func (*Playlist) GetDuration ¶
func (*Playlist) GetItemType ¶
func (*Playlist) GetLibraryID ¶ added in v1.0.3
func (*Playlist) GetSortTitle ¶
func (*Playlist) GetUpdatedAt ¶
func (*Playlist) GetWatchStatus ¶
func (p *Playlist) GetWatchStatus() WatchStatus
type PlaylistClient ¶
type PlaylistClient interface {
GetPlaylists(ctx context.Context) ([]*Playlist, error)
GetPlaylistItems(ctx context.Context, playlistID string) ([]*MediaItem, error)
CreatePlaylist(ctx context.Context, title string, itemIDs []string) (*Playlist, error)
AddToPlaylist(ctx context.Context, playlistID string, itemIDs []string) error
RemoveFromPlaylist(ctx context.Context, playlistID string, itemID string) error
DeletePlaylist(ctx context.Context, playlistID string) error
}
PlaylistClient provides network operations for playlist management.
type ProgressFunc ¶
type ProgressFunc func(loaded, total int)
ProgressFunc reports download progress to TUI. Called repeatedly during pagination: (50, 500), (100, 500), ...
type SearchClient ¶
SearchClient provides network search functionality.
type Season ¶
type Season struct {
ID string // Server-specific unique identifier
LibraryID string // Parent library ID
ShowID string // Parent show ID
ShowTitle string // Parent show name
SeasonNum int // Season number (0 = Specials)
Title string // "Season 1" or custom name
EpisodeCount int // Total number of episodes
UnwatchedCount int // Number of unwatched episodes
// Image URLs
ThumbURL string // Poster/thumbnail image URL
}
Season represents a season container
func (*Season) CanDrillDown ¶
func (Season) DisplayTitle ¶
DisplayTitle returns the display title for the season
func (*Season) GetAddedAt ¶
func (*Season) GetDescription ¶
func (*Season) GetDuration ¶
func (*Season) GetItemType ¶
func (*Season) GetLibraryID ¶ added in v1.0.3
func (*Season) GetSortTitle ¶
func (*Season) GetUpdatedAt ¶
func (*Season) GetWatchStatus ¶
func (s *Season) GetWatchStatus() WatchStatus
func (Season) WatchStatus ¶
func (s Season) WatchStatus() WatchStatus
WatchStatus returns the watch status of the season
type Show ¶
type Show struct {
ID string // Server-specific unique identifier
Title string // Series title
SortTitle string // Title used for sorting
LibraryID string // Parent library ID
Summary string // Series synopsis
Year int // First air year
AddedAt int64 // Unix timestamp when added to library
UpdatedAt int64 // Unix timestamp when last updated
SeasonCount int // Total number of seasons
EpisodeCount int // Total number of episodes
UnwatchedCount int // Number of unwatched episodes
// Rating (0-10 scale, audience/community rating)
Rating float64
// Content rating (e.g., "TV-MA", "TV-PG")
ContentRating string
// Image URLs
ThumbURL string // Poster/thumbnail image URL
ArtURL string // Background art URL
}
Show represents a TV series container
func (*Show) CanDrillDown ¶
func (*Show) GetAddedAt ¶
func (*Show) GetDescription ¶
func (*Show) GetDuration ¶
func (*Show) GetItemType ¶
func (*Show) GetLibraryID ¶ added in v1.0.3
func (*Show) GetSortTitle ¶
func (*Show) GetUpdatedAt ¶
func (*Show) GetWatchStatus ¶
func (s *Show) GetWatchStatus() WatchStatus
func (Show) WatchStatus ¶
func (s Show) WatchStatus() WatchStatus
WatchStatus returns the watch status of the show
type Store ¶
type Store interface {
// === Libraries ===
GetLibraries() ([]Library, bool)
SaveLibraries(libs []Library) error
// === Library Content ===
GetMovies(libID string) ([]*MediaItem, bool)
SaveMovies(libID string, movies []*MediaItem, serverTS int64) error
GetShows(libID string) ([]*Show, bool)
SaveShows(libID string, shows []*Show, serverTS int64) error
GetMixedContent(libID string) ([]ListItem, bool)
SaveMixedContent(libID string, items []ListItem, serverTS int64) error
// === Hierarchical (TV) ===
GetSeasons(libID, showID string) ([]*Season, bool)
SaveSeasons(libID, showID string, seasons []*Season) error
GetEpisodes(libID, showID, seasonID string) ([]*MediaItem, bool)
GetAllEpisodes(libID string) ([]*MediaItem, bool)
SaveEpisodes(libID, showID, seasonID string, episodes []*MediaItem) error
// === Playlists ===
GetPlaylists() ([]*Playlist, bool)
SavePlaylists(playlists []*Playlist) error
GetPlaylistItems(playlistID string) ([]*MediaItem, bool)
SavePlaylistItems(playlistID string, items []*MediaItem) error
// === Local Queue ===
GetQueueItems() ([]*MediaItem, bool)
SaveQueueItems(items []*MediaItem) error
// === Freshness ===
IsValid(libID string, serverTS int64) bool
// === Invalidation ===
InvalidateLibrary(libID string)
InvalidateShow(libID, showID string)
InvalidateSeason(libID, showID, seasonID string)
InvalidatePlaylists()
InvalidatePlaylistItems(playlistID string)
InvalidateQueue()
InvalidateAll()
Close() error
}
Store handles local cache (BoltDB + memory). TUI reads directly from Store for cache access.
type Subtitle ¶ added in v1.0.1
type Subtitle struct {
URL string // Direct URL the player can fetch
Language string // ISO language code, e.g. "eng", "spa"
Title string // Human-readable label (may be empty)
Codec string // e.g. "srt", "ass", "vtt"
Default bool // Server marked this track as default
Forced bool // Forced subtitle track
}
Subtitle describes an external subtitle track that the player should side-load.
type SyncResult ¶
type SyncResult struct {
LibraryID string // Which library this result is for
FromCache bool // true if cache was fresh (no network fetch)
Count int // total items after sync
}
SyncResult summarizes what happened during a sync operation.
type WatchStatus ¶
type WatchStatus int
WatchStatus represents the viewing state of media
const ( WatchStatusUnwatched WatchStatus = iota WatchStatusInProgress WatchStatusWatched )
func (WatchStatus) String ¶
func (w WatchStatus) String() string
String returns a human-readable representation of the watch status