Add download all button and include options to automatically download new episodes

This commit is contained in:
Alex McGrath
2021-02-19 15:44:22 +00:00
committed by Senan Kelly
parent 2a11017d54
commit 10fca91785
8 changed files with 157 additions and 32 deletions

View File

@@ -81,6 +81,7 @@ func New(path string) (*DB, error) {
migrateListenBrainz(),
migratePodcast(),
migrateBookmarks(),
migratePodcastAutoDownload(),
))
if err = migr.Migrate(); err != nil {
return nil, fmt.Errorf("migrating to latest version: %w", err)

View File

@@ -250,3 +250,15 @@ func migrateBookmarks() gormigrate.Migration {
},
}
}
func migratePodcastAutoDownload() gormigrate.Migration {
return gormigrate.Migration{
ID: "202102191448",
Migrate: func(tx *gorm.DB) error {
return tx.AutoMigrate(
Podcast{},
).
Error
},
}
}

View File

@@ -290,17 +290,18 @@ type AlbumGenre struct {
}
type Podcast struct {
ID int `gorm:"primary_key"`
UpdatedAt time.Time
ModifiedAt time.Time
UserID int `sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
URL string
Title string
Description string
ImageURL string
ImagePath string
Error string
Episodes []*PodcastEpisode
ID int `gorm:"primary_key"`
UpdatedAt time.Time
ModifiedAt time.Time
UserID int `sql:"default: null; type:int REFERENCES users(id) ON DELETE CASCADE"`
URL string
Title string
Description string
ImageURL string
ImagePath string
Error string
Episodes []*PodcastEpisode
AutoDownload string
}
func (p *Podcast) Fullpath(podcastPath string) string {