This commit is contained in:
2026-08-23 14:13:18 -05:00
parent 789bf91eed
commit 866f243f1b
37 changed files with 1761 additions and 58 deletions
+24
View File
@@ -252,6 +252,30 @@ func (m *Manager) DownloadEpisode(ctx context.Context, episodeID string) error {
return database.SetPodcastEpisodeMediaFile(m.DB, episodeID, mf.ID)
}
// DownloadChannel downloads every episode in a channel that is not already
// complete or in progress. Downloads are run in feed order and still pass
// through the manager's concurrency limiter.
func (m *Manager) DownloadChannel(ctx context.Context, channelID string) error {
episodes, err := database.ListPodcastEpisodes(m.DB, channelID)
if err != nil {
return err
}
for _, episode := range episodes {
if episode.Status == "completed" || episode.Status == "downloading" {
continue
}
if err := m.DownloadEpisode(ctx, episode.ID); err != nil {
if m.Log != nil {
m.Log.Warn("podcast episode download failed", "episode", episode.ID, "err", err)
}
}
if err := ctx.Err(); err != nil {
return err
}
}
return nil
}
func (m *Manager) downloadToFile(ctx context.Context, sourceURL, destPath string) error {
if err := netguard.ValidateURL(sourceURL); err != nil {
return err