refactor: modularize downloader architecture

This commit is contained in:
OpenClaw Agent
2026-09-16 06:41:45 +08:00
parent 6c585ff835
commit 285064d144
11 changed files with 766 additions and 558 deletions
+32
View File
@@ -0,0 +1,32 @@
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
}