feat: add yt-dlp support for downloading video/audio and enhance related commands

This commit is contained in:
krau
2026-01-17 17:42:11 +08:00
parent cd7cf4964d
commit 3ce00884a0
16 changed files with 602 additions and 4 deletions

View File

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

View File

@@ -22,6 +22,8 @@ const (
TaskTypeDirectlinks TaskType = "directlinks"
// TaskTypeAria2 is a TaskType of type aria2.
TaskTypeAria2 TaskType = "aria2"
// TaskTypeYtdlp is a TaskType of type ytdlp.
TaskTypeYtdlp TaskType = "ytdlp"
)
var ErrInvalidTaskType = fmt.Errorf("not a valid TaskType, try [%s]", strings.Join(_TaskTypeNames, ", "))
@@ -32,6 +34,7 @@ var _TaskTypeNames = []string{
string(TaskTypeParseditem),
string(TaskTypeDirectlinks),
string(TaskTypeAria2),
string(TaskTypeYtdlp),
}
// TaskTypeNames returns a list of possible string values of TaskType.
@@ -49,6 +52,7 @@ func TaskTypeValues() []TaskType {
TaskTypeParseditem,
TaskTypeDirectlinks,
TaskTypeAria2,
TaskTypeYtdlp,
}
}
@@ -70,6 +74,7 @@ var _TaskTypeValue = map[string]TaskType{
"parseditem": TaskTypeParseditem,
"directlinks": TaskTypeDirectlinks,
"aria2": TaskTypeAria2,
"ytdlp": TaskTypeYtdlp,
}
// ParseTaskType attempts to convert a string to a TaskType.

View File

@@ -47,6 +47,8 @@ type Add struct {
DirectLinks []string
// aria2
Aria2URIs []string
// ytdlp
YtdlpURLs []string
}
type SetDefaultStorage struct {