Some playlist support
This commit is contained in:
32
models.go
32
models.go
@@ -25,13 +25,17 @@ const (
|
||||
|
||||
type Original struct {
|
||||
gorm.Model
|
||||
UserID uint
|
||||
URL string
|
||||
Title string
|
||||
Artist string
|
||||
Status OriginalStatus
|
||||
Audio bool // video download requested
|
||||
Video bool // audio download requested
|
||||
UserID uint
|
||||
URL string
|
||||
Title string
|
||||
Artist string
|
||||
Status OriginalStatus
|
||||
Audio bool // video download requested
|
||||
Video bool // audio download requested
|
||||
Watched bool
|
||||
|
||||
Playlist bool // part of a playlist
|
||||
PlaylistID uint // Playlist.ID (if part of a playlist)
|
||||
}
|
||||
|
||||
type Transcode struct {
|
||||
@@ -53,6 +57,16 @@ type Transcode struct {
|
||||
Rate uint
|
||||
}
|
||||
|
||||
type Playlist struct {
|
||||
gorm.Model
|
||||
UserID uint
|
||||
URL string
|
||||
Title string
|
||||
Status OriginalStatus
|
||||
Audio bool
|
||||
Video bool
|
||||
}
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
Username string `gorm:"unique"`
|
||||
@@ -91,6 +105,10 @@ func SetOriginalStatus(id uint, status OriginalStatus) error {
|
||||
return db.Model(&Original{}).Where("id = ?", id).Update("status", status).Error
|
||||
}
|
||||
|
||||
func SetPlaylistStatus(id uint, status OriginalStatus) error {
|
||||
return db.Model(&Playlist{}).Where("id = ?", id).Update("status", status).Error
|
||||
}
|
||||
|
||||
func NewDownloadManager() *DownloadManager {
|
||||
return &DownloadManager{
|
||||
downloads: make(map[uint]*DownloadStatus),
|
||||
|
Reference in New Issue
Block a user