refactor: modularize downloader architecture
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package main
|
||||
|
||||
import "time"
|
||||
|
||||
type Task struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
Source string `gorm:"uniqueIndex:idx_tasks_source_rid_quality" json:"source"`
|
||||
RID string `gorm:"uniqueIndex:idx_tasks_source_rid_quality" json:"rid"`
|
||||
Title string `json:"title"`
|
||||
Artist string `json:"artist"`
|
||||
Album string `json:"album"`
|
||||
Pic string `json:"pic"`
|
||||
Quality string `gorm:"uniqueIndex:idx_tasks_source_rid_quality" json:"quality"`
|
||||
ResolvedQuality string `json:"resolvedQuality,omitempty"`
|
||||
ActualQuality string `json:"actualQuality,omitempty"`
|
||||
Format string `json:"format"`
|
||||
Status string `json:"status"`
|
||||
Error string `json:"error,omitempty"`
|
||||
LocalPath string `json:"localPath,omitempty"`
|
||||
RemotePath string `json:"remotePath,omitempty"`
|
||||
TotalBytes int64 `json:"totalBytes"`
|
||||
DownloadedBytes int64 `json:"downloadedBytes"`
|
||||
Progress float64 `json:"progress"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type Setting struct {
|
||||
ID uint `gorm:"primaryKey"`
|
||||
Key string `gorm:"uniqueIndex"`
|
||||
Value string
|
||||
}
|
||||
|
||||
type SongRequest struct {
|
||||
Source string `json:"source"`
|
||||
RID string `json:"rid"`
|
||||
Title string `json:"title"`
|
||||
Artist string `json:"artist"`
|
||||
Album string `json:"album"`
|
||||
Pic string `json:"pic"`
|
||||
Quality string `json:"quality"`
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
AMAPI, DownloadDir, WebDAVURL, WebDAVUser, WebDAVPass, WebDAVPath, DefaultQuality, WebDAVVersionPolicy, LocalFilePolicy string
|
||||
WorkerCount int
|
||||
}
|
||||
|
||||
type playInfo struct {
|
||||
URL string `json:"url"`
|
||||
Level string `json:"level"`
|
||||
Format string `json:"format"`
|
||||
Headers map[string]string `json:"headers"`
|
||||
}
|
||||
Reference in New Issue
Block a user