fix(podcast): add error case for when DownloadEpisode is called via API and podcast is already downloaded
closes: #213 Co-authored-by: Brian Doherty <brian.r.doherty@gmail.com>
This commit is contained in:
@@ -18,9 +18,9 @@ import (
|
|||||||
"github.com/jinzhu/gorm"
|
"github.com/jinzhu/gorm"
|
||||||
"github.com/mmcdole/gofeed"
|
"github.com/mmcdole/gofeed"
|
||||||
|
|
||||||
"go.senan.xyz/gonic/multierr"
|
|
||||||
"go.senan.xyz/gonic/db"
|
"go.senan.xyz/gonic/db"
|
||||||
gmime "go.senan.xyz/gonic/mime"
|
gmime "go.senan.xyz/gonic/mime"
|
||||||
|
"go.senan.xyz/gonic/multierr"
|
||||||
"go.senan.xyz/gonic/scanner/tags"
|
"go.senan.xyz/gonic/scanner/tags"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -354,8 +354,8 @@ func (p *Podcasts) DownloadEpisode(episodeID int) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("get podcast by id: %w", err)
|
return fmt.Errorf("get podcast by id: %w", err)
|
||||||
}
|
}
|
||||||
if podcastEpisode.Status == db.PodcastEpisodeStatusDownloading {
|
if podcastEpisode.Status == db.PodcastEpisodeStatusDownloading || podcastEpisode.Status == db.PodcastEpisodeStatusCompleted {
|
||||||
log.Printf("Already downloading podcast episode with id %d", episodeID)
|
log.Printf("already downloading podcast episode with id %d", episodeID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
podcastEpisode.Status = db.PodcastEpisodeStatusDownloading
|
podcastEpisode.Status = db.PodcastEpisodeStatusDownloading
|
||||||
|
|||||||
Reference in New Issue
Block a user