mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-15 20:38:10 +08:00
feat: support import files from storages to telegram (#183)
* feat: add import command and batch import functionality - Implemented the `/import` command to allow users to import files from storage to Telegram. - Added support for listing files in storage and filtering based on regex patterns. - Created a batch import task to handle multiple file uploads concurrently. - Introduced progress tracking for batch imports, providing real-time updates to users. - Enhanced storage interfaces to support file listing and reading capabilities. - Updated localization files for the new import command and its usage instructions. - Added utility functions for file size formatting and speed calculation. - Refactored Telegram storage handling to support reading from non-seekable streams. * feat: add i18n for import command * feat: implement ListFiles and OpenFile methods for WebDAV and Alist storage * Update common/i18n/locale/zh-Hans.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update core/tasks/batchimport/progress.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update core/tasks/batchimport/execute.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update storage/alist/alist.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update common/i18n/locale/en.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update pkg/storagetypes/fileinfo.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update common/i18n/locale/en.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update core/tasks/batchimport/execute.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update storage/webdav/webdav.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update storage/telegram/telegram.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update core/tasks/batchimport/execute.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update storage/webdav/webdav.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: missing progress stats i18n * refactor: use strutil to parse args * chore: update generated code files for consistency --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package tasktype
|
||||
|
||||
// ENUM(tgfiles,tphpics,parseditem,directlinks,aria2,ytdlp)
|
||||
//
|
||||
//go:generate go-enum --values --names --flag --nocase
|
||||
// ENUM(tgfiles,tphpics,parseditem,directlinks,aria2,ytdlp,batchimport)
|
||||
type TaskType string
|
||||
|
||||
@@ -24,6 +24,8 @@ const (
|
||||
TaskTypeAria2 TaskType = "aria2"
|
||||
// TaskTypeYtdlp is a TaskType of type ytdlp.
|
||||
TaskTypeYtdlp TaskType = "ytdlp"
|
||||
// TaskTypeBatchimport is a TaskType of type batchimport.
|
||||
TaskTypeBatchimport TaskType = "batchimport"
|
||||
)
|
||||
|
||||
var ErrInvalidTaskType = fmt.Errorf("not a valid TaskType, try [%s]", strings.Join(_TaskTypeNames, ", "))
|
||||
@@ -35,6 +37,7 @@ var _TaskTypeNames = []string{
|
||||
string(TaskTypeDirectlinks),
|
||||
string(TaskTypeAria2),
|
||||
string(TaskTypeYtdlp),
|
||||
string(TaskTypeBatchimport),
|
||||
}
|
||||
|
||||
// TaskTypeNames returns a list of possible string values of TaskType.
|
||||
@@ -53,6 +56,7 @@ func TaskTypeValues() []TaskType {
|
||||
TaskTypeDirectlinks,
|
||||
TaskTypeAria2,
|
||||
TaskTypeYtdlp,
|
||||
TaskTypeBatchimport,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +79,7 @@ var _TaskTypeValue = map[string]TaskType{
|
||||
"directlinks": TaskTypeDirectlinks,
|
||||
"aria2": TaskTypeAria2,
|
||||
"ytdlp": TaskTypeYtdlp,
|
||||
"batchimport": TaskTypeBatchimport,
|
||||
}
|
||||
|
||||
// ParseTaskType attempts to convert a string to a TaskType.
|
||||
|
||||
Reference in New Issue
Block a user