use enum for PodcastEpisodeStatus and PodcastAutoDownload

This commit is contained in:
sentriz
2021-03-04 19:26:24 +00:00
committed by Senan Kelly
parent 512d967dfa
commit 3c926aab99
6 changed files with 1091 additions and 1075 deletions

View File

@@ -289,6 +289,13 @@ type AlbumGenre struct {
GenreID int `gorm:"not null; unique_index:idx_album_id_genre_id" sql:"default: null; type:int REFERENCES genres(id) ON DELETE CASCADE"`
}
type PodcastAutoDownload string
const (
PodcastAutoDownloadLatest PodcastAutoDownload = "latest"
PodcastAutoDownloadNone PodcastAutoDownload = "none"
)
type Podcast struct {
ID int `gorm:"primary_key"`
UpdatedAt time.Time
@@ -301,7 +308,7 @@ type Podcast struct {
ImagePath string
Error string
Episodes []*PodcastEpisode
AutoDownload string
AutoDownload PodcastAutoDownload
}
func (p *Podcast) Fullpath(podcastPath string) string {
@@ -313,6 +320,15 @@ func (p *Podcast) SID() *specid.ID {
return &specid.ID{Type: specid.Podcast, Value: p.ID}
}
type PodcastEpisodeStatus string
const (
PodcastEpisodeStatusDownloading PodcastEpisodeStatus = "downloading"
PodcastEpisodeStatusSkipped PodcastEpisodeStatus = "skipped"
PodcastEpisodeStatusDeleted PodcastEpisodeStatus = "deleted"
PodcastEpisodeStatusCompleted PodcastEpisodeStatus = "completed"
)
type PodcastEpisode struct {
ID int `gorm:"primary_key"`
CreatedAt time.Time
@@ -328,7 +344,7 @@ type PodcastEpisode struct {
Size int
Path string
Filename string
Status string
Status PodcastEpisodeStatus
Error string
}