feat: basic aria2 integration

This commit is contained in:
krau
2026-01-17 14:57:03 +08:00
parent f17a380579
commit b05d86509c
16 changed files with 809 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
package tasktype
//go:generate go-enum --values --names --flag --nocase
// ENUM(tgfiles,tphpics,parseditem,directlinks)
// ENUM(tgfiles,tphpics,parseditem,directlinks,aria2)
type TaskType string

View File

@@ -20,6 +20,8 @@ const (
TaskTypeParseditem TaskType = "parseditem"
// TaskTypeDirectlinks is a TaskType of type directlinks.
TaskTypeDirectlinks TaskType = "directlinks"
// TaskTypeAria2 is a TaskType of type aria2.
TaskTypeAria2 TaskType = "aria2"
)
var ErrInvalidTaskType = fmt.Errorf("not a valid TaskType, try [%s]", strings.Join(_TaskTypeNames, ", "))
@@ -29,6 +31,7 @@ var _TaskTypeNames = []string{
string(TaskTypeTphpics),
string(TaskTypeParseditem),
string(TaskTypeDirectlinks),
string(TaskTypeAria2),
}
// TaskTypeNames returns a list of possible string values of TaskType.
@@ -45,6 +48,7 @@ func TaskTypeValues() []TaskType {
TaskTypeTphpics,
TaskTypeParseditem,
TaskTypeDirectlinks,
TaskTypeAria2,
}
}
@@ -65,6 +69,7 @@ var _TaskTypeValue = map[string]TaskType{
"tphpics": TaskTypeTphpics,
"parseditem": TaskTypeParseditem,
"directlinks": TaskTypeDirectlinks,
"aria2": TaskTypeAria2,
}
// ParseTaskType attempts to convert a string to a TaskType.

View File

@@ -45,6 +45,8 @@ type Add struct {
ParsedItem *parser.Item
// directlinks
DirectLinks []string
// aria2
Aria2URIs []string
}
type SetDefaultStorage struct {