Documentation
¶
Index ¶
- Variables
- func CanonicalPlaylistSourceName(raw string) string
- func CanonicalPlaylistSourceURL(raw string) string
- type CatalogStore
- type Fetcher
- type Group
- type Item
- type ItemStream
- type Manager
- func (m *Manager) FetchAndParse(ctx context.Context, playlistURL string) ([]Item, error)
- func (m *Manager) FetchAndParseEach(ctx context.Context, playlistURL string, onItem func(Item) error) (int, error)
- func (m *Manager) Parse(r io.Reader) ([]Item, error)
- func (m *Manager) ParseEach(r io.Reader, onItem func(Item) error) (int, error)
- type PlaylistSource
- type PlaylistSourceBulkUpdate
- type PlaylistSourceCreate
- type PlaylistSourceUpdate
- type Query
- type Refresher
- type SourceCatalogStore
- type StreamingCatalogStore
- type StreamingFetcher
- type StreamingSourceCatalogStore
Constants ¶
This section is empty.
Variables ¶
var ( ErrPlaylistSourceNotFound = errors.New("playlist source not found") ErrPlaylistSourceOrderDrift = errors.New("playlist source set changed") ErrPrimaryPlaylistSourceDelete = errors.New("primary playlist source cannot be deleted") ErrPrimaryPlaylistSourceOrderChange = errors.New("primary playlist source cannot be removed from reorder set") ErrNoEnabledPlaylistSources = errors.New("at least one enabled playlist source is required") )
Functions ¶
func CanonicalPlaylistSourceName ¶ added in v1.1.0
CanonicalPlaylistSourceName returns the normalized comparison key used for source-name uniqueness checks across config, API, and store mutation paths.
func CanonicalPlaylistSourceURL ¶ added in v1.1.0
CanonicalPlaylistSourceURL returns the normalized comparison key used for source URL uniqueness checks across config, API, and store mutation paths.
Canonicalization rules: - trim surrounding whitespace - lowercase scheme and host - preserve path/query/fragment semantics - if parsing fails, fall back to lowercased raw string
Types ¶
type CatalogStore ¶
CatalogStore persists playlist catalog items.
type Item ¶
type Item struct {
ItemKey string
ChannelKey string
Name string
Group string
StreamURL string
TVGID string
TVGLogo string
PlaylistSourceID int64
PlaylistSourceName string
Attrs map[string]string
FirstSeenAt int64
LastSeenAt int64
Active bool
}
Item is a normalized playlist entry used by catalog and favorites workflows.
type ItemStream ¶
ItemStream incrementally emits playlist items to a callback.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager fetches and parses remote playlists.
func NewManager ¶
func (*Manager) FetchAndParse ¶
type PlaylistSource ¶ added in v1.1.0
type PlaylistSource struct {
SourceID int64 `json:"source_id"`
SourceKey string `json:"source_key"`
Name string `json:"name"`
PlaylistURL string `json:"playlist_url"`
TunerCount int `json:"tuner_count"`
Enabled bool `json:"enabled"`
OrderIndex int `json:"order_index"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
PlaylistSource describes one configured playlist ingest source.
type PlaylistSourceBulkUpdate ¶ added in v1.1.0
type PlaylistSourceBulkUpdate struct {
SourceID int64
Name string
PlaylistURL string
TunerCount int
Enabled bool
}
PlaylistSourceBulkUpdate carries one ordered source mutation entry for atomic multi-source update operations.
type PlaylistSourceCreate ¶ added in v1.1.0
type PlaylistSourceCreate struct {
Name string `json:"name"`
PlaylistURL string `json:"playlist_url"`
TunerCount int `json:"tuner_count"`
Enabled *bool `json:"enabled,omitempty"`
}
PlaylistSourceCreate carries create arguments for one playlist source.
type PlaylistSourceUpdate ¶ added in v1.1.0
type PlaylistSourceUpdate struct {
Name *string `json:"name,omitempty"`
PlaylistURL *string `json:"playlist_url,omitempty"`
TunerCount *int `json:"tuner_count,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
PlaylistSourceUpdate carries mutable source fields.
type Query ¶
type Query struct {
SourceIDs []int64
Group string
GroupNames []string
Search string
SearchRegex bool
Limit int
Offset int
}
Query controls catalog filtering and pagination.
type Refresher ¶
type Refresher struct {
// contains filtered or unexported fields
}
Refresher coordinates fetch + persist operations.
func NewRefresher ¶
func NewRefresher(fetcher Fetcher, store CatalogStore, logger ...*slog.Logger) *Refresher
func (*Refresher) RefreshForSource ¶ added in v1.1.0
RefreshForSource refreshes one playlist source into source-scoped catalog storage.
type SourceCatalogStore ¶ added in v1.1.0
type SourceCatalogStore interface {
UpsertPlaylistItemsForSource(ctx context.Context, sourceID int64, items []Item) error
}
SourceCatalogStore persists playlist items for one playlist source.
type StreamingCatalogStore ¶
type StreamingCatalogStore interface {
UpsertPlaylistItemsStream(ctx context.Context, stream ItemStream) (int, error)
}
StreamingCatalogStore persists playlist items from a streaming source.
type StreamingFetcher ¶
type StreamingFetcher interface {
FetchAndParseEach(ctx context.Context, playlistURL string, onItem func(Item) error) (int, error)
}
StreamingFetcher fetches and parses playlists incrementally.
type StreamingSourceCatalogStore ¶ added in v1.1.0
type StreamingSourceCatalogStore interface {
UpsertPlaylistItemsStreamForSource(ctx context.Context, sourceID int64, stream ItemStream) (int, error)
}
StreamingSourceCatalogStore persists playlist items incrementally for one playlist source.