You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
podgrab/db/podcast.go

94 lines
1.5 KiB

4 years ago
package db
import (
"time"
)
//Podcast is
type Podcast struct {
Base
Title string
Summary string `gorm:"type:text"`
Author string
Image string
URL string
LastEpisode *time.Time
PodcastItems []PodcastItem
DownloadedEpisodesCount int `gorm:"-"`
DownloadingEpisodesCount int `gorm:"-"`
AllEpisodesCount int `gorm:"-"`
4 years ago
}
//PodcastItem is
type PodcastItem struct {
Base
PodcastID string
Podcast Podcast
Title string
Summary string `gorm:"type:text"`
EpisodeType string
Duration int
PubDate time.Time
FileURL string
GUID string
Image string
4 years ago
DownloadDate time.Time
DownloadPath string
DownloadStatus DownloadStatus `gorm:"default:0"`
IsPlayed bool `gorm:"default:false"`
4 years ago
}
4 years ago
type DownloadStatus int
const (
NotDownloaded DownloadStatus = iota
Downloading
Downloaded
Deleted
)
4 years ago
type Setting struct {
Base
DownloadOnAdd bool `gorm:"default:true"`
InitialDownloadCount int `gorm:"default:5"`
AutoDownload bool `gorm:"default:true"`
AppendDateToFileName bool `gorm:"default:false"`
AppendEpisodeNumberToFileName bool `gorm:"default:false"`
4 years ago
}
type Migration struct {
Base
Date time.Time
Name string
}
type JobLock struct {
Base
Date time.Time
Name string
Duration int
}
func (lock *JobLock) IsLocked() bool {
return lock != nil && lock.Date != time.Time{}
}
type PodcastItemStatsModel struct {
PodcastID string
DownloadStatus DownloadStatus
Count int
}