Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/internal/offline_download/tool/base.go
1562 views
1
package tool
2
3
import (
4
"github.com/alist-org/alist/v3/internal/model"
5
)
6
7
type AddUrlArgs struct {
8
Url string
9
UID string
10
TempDir string
11
Signal chan int
12
}
13
14
type Status struct {
15
TotalBytes int64
16
Progress float64
17
NewGID string
18
Completed bool
19
Status string
20
Err error
21
}
22
23
type Tool interface {
24
Name() string
25
// Items return the setting items the tool need
26
Items() []model.SettingItem
27
Init() (string, error)
28
IsReady() bool
29
// AddURL add an uri to download, return the task id
30
AddURL(args *AddUrlArgs) (string, error)
31
// Remove the download if task been canceled
32
Remove(task *DownloadTask) error
33
// Status return the status of the download task, if an error occurred, return the error in Status.Err
34
Status(task *DownloadTask) (*Status, error)
35
36
// Run for simple http download
37
Run(task *DownloadTask) error
38
}
39
40