Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoMatchingPlatform = NewError(101, "no matching platform found") ErrDownloadFailed = NewError(102, "failed to download episode") ErrEpisodeInProgress = NewError(103, "episode already in progress") ErrEpisodeExists = NewError(104, "episode already exists") ErrProcessInterrupted = NewError(105, "process was interrupted") ErrEmptyFeed = NewError(106, "feed has no items") ErrInvalidRequest = NewError(107, "invalid download request") ErrProcessUpsert = NewError(201, "failed to update process") ErrProcessGetByURL = NewError(202, "failed to get process by URL") ErrEpisodeGetByOriginalURL = NewError(203, "failed to get episode by original URL") ErrEpisodeCreate = NewError(204, "failed to create episode") ErrProcessGetByStatus = NewError(205, "failed to get process by status") )
Functions ¶
This section is empty.
Types ¶
type Downloader ¶
type Downloader interface {
Download(ctx context.Context, req entities.Request) (*entities.Episode, error)
}
Downloader is an interface for downloading episodes.
type EpisodeService ¶
type EpisodeService struct {
// contains filtered or unexported fields
}
func NewEpisodeService ¶
func NewEpisodeService(cfg *config.Settings, log *slog.Logger, s Store, p ...Platform) *EpisodeService
NewEpisodeService creates a new EpisodeService instance.
type FeedService ¶
type FeedService struct {
// contains filtered or unexported fields
}
FeedService builds RSS podcast feed from episodes.
func NewFeedService ¶
NewFeedService creates a new FeedService instance.
type Platform ¶
type Platform interface {
ID() string
Init(ctx context.Context) error
Match(url string) bool
Download(ctx context.Context, req entities.Request) (*entities.Episode, error)
}
Platform is an interface for different download platforms.
type ProcessService ¶
type ProcessService struct {
// contains filtered or unexported fields
}
ProcessService handles the processing of download requests.
func NewProcessService ¶
func NewProcessService(cfg *config.Settings, log *slog.Logger, s Store, d Downloader, b Builder) *ProcessService
NewProcessService creates a new ProcessService instance.
func (*ProcessService) In ¶
func (s *ProcessService) In() chan<- entities.Request
In returns the input channel for receiving download requests.
func (*ProcessService) Init ¶
func (s *ProcessService) Init(ctx context.Context) error
Init initializes the service before starting. It fails all in-progress processes to ensure a clean state.
func (*ProcessService) Out ¶
func (s *ProcessService) Out() <-chan entities.Process
Out returns the output channel for sending notifications about process completion.
func (*ProcessService) Start ¶
func (s *ProcessService) Start(ctx context.Context)
Start begins processing download requests. It runs until the provided context is canceled.