Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(podcast): add error case for when DownloadEpisode is called via A…
…PI and podcast is already downloaded

closes: #213

Co-authored-by: Brian Doherty <brian.r.doherty@gmail.com>
  • Loading branch information
sentriz and brian-doherty committed Apr 20, 2022
1 parent 8b803ec commit 611bc96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions podcasts/podcasts.go
Expand Up @@ -18,9 +18,9 @@ import (
"github.com/jinzhu/gorm"
"github.com/mmcdole/gofeed"

"go.senan.xyz/gonic/multierr"
"go.senan.xyz/gonic/db"
gmime "go.senan.xyz/gonic/mime"
"go.senan.xyz/gonic/multierr"
"go.senan.xyz/gonic/scanner/tags"
)

Expand Down Expand Up @@ -354,8 +354,8 @@ func (p *Podcasts) DownloadEpisode(episodeID int) error {
if err != nil {
return fmt.Errorf("get podcast by id: %w", err)
}
if podcastEpisode.Status == db.PodcastEpisodeStatusDownloading {
log.Printf("Already downloading podcast episode with id %d", episodeID)
if podcastEpisode.Status == db.PodcastEpisodeStatusDownloading || podcastEpisode.Status == db.PodcastEpisodeStatusCompleted {
log.Printf("already downloading podcast episode with id %d", episodeID)
return nil
}
podcastEpisode.Status = db.PodcastEpisodeStatusDownloading
Expand Down

0 comments on commit 611bc96

Please sign in to comment.