Files

33 lines
743 B
Go

package main
import (
"net/http"
"sync"
"gorm.io/gorm"
)
type App struct {
db *gorm.DB
cfg Config
queue chan uint
wg sync.WaitGroup
httpClient *http.Client
am AMClient
storage RemoteStorage
}
// AMClient isolates the music API from the task engine.
type AMClient interface {
Search(keyword, source string, page, limit int) (*http.Response, error)
Resolve(source, rid, quality string) (playInfo, error)
}
// RemoteStorage isolates WebDAV and leaves room for S3/local backends later.
type RemoteStorage interface {
Upload(localPath, remotePath string) error
ExistsSameSize(remotePath string, size int64) (bool, error)
Remove(remotePath string) error
MkdirAll(remoteDir string) error
}