playlist

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogStore

type CatalogStore interface {
	UpsertPlaylistItems(ctx context.Context, items []Item) error
}

CatalogStore persists playlist catalog items.

type Fetcher

type Fetcher interface {
	FetchAndParse(ctx context.Context, playlistURL string) ([]Item, error)
}

Fetcher fetches and parses playlists from an external source.

type Group

type Group struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

Group represents a playlist group with item count.

type Item

type Item struct {
	ItemKey     string
	ChannelKey  string
	Name        string
	Group       string
	StreamURL   string
	TVGID       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

type ItemStream func(yield func(Item) error) error

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 NewManager(client *http.Client) *Manager

func (*Manager) FetchAndParse

func (m *Manager) FetchAndParse(ctx context.Context, playlistURL string) ([]Item, error)

func (*Manager) FetchAndParseEach

func (m *Manager) FetchAndParseEach(ctx context.Context, playlistURL string, onItem func(Item) error) (int, error)

FetchAndParseEach fetches a remote playlist and emits normalized entries incrementally.

func (*Manager) Parse

func (m *Manager) Parse(r io.Reader) ([]Item, error)

func (*Manager) ParseEach

func (m *Manager) ParseEach(r io.Reader, onItem func(Item) error) (int, error)

ParseEach parses playlist content and emits normalized entries incrementally.

type Query

type Query struct {
	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 with a single refresh lock.

func NewRefresher

func NewRefresher(fetcher Fetcher, store CatalogStore, logger ...*slog.Logger) *Refresher

func (*Refresher) Refresh

func (r *Refresher) Refresh(ctx context.Context, playlistURL string) (int, error)

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.

Jump to

Keyboard shortcuts

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