- Implemented a new task type for handling direct links downloads. - Added command handler for downloading multiple links via /dl command. - Introduced progress tracking for direct link downloads. - Enhanced filename parsing to support various encoding scenarios. - Updated enums to include direct links as a task type. - Refactored existing task structures to accommodate new functionality. - Improved error handling and logging throughout the download process.
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package tcbdata
|
|
|
|
import (
|
|
"github.com/krau/SaveAny-Bot/pkg/enums/tasktype"
|
|
"github.com/krau/SaveAny-Bot/pkg/parser"
|
|
"github.com/krau/SaveAny-Bot/pkg/telegraph"
|
|
"github.com/krau/SaveAny-Bot/pkg/tfile"
|
|
)
|
|
|
|
const (
|
|
TypeAdd = "add"
|
|
TypeSetDefault = "setdefault"
|
|
TypeConfig = "config"
|
|
TypeCancel = "cancel"
|
|
)
|
|
|
|
// type TaskDataTGFiles struct {
|
|
// Files []tfile.TGFileMessage
|
|
// AsBatch bool
|
|
// }
|
|
|
|
// type TaskDataTelegraph struct {
|
|
// Pics []string
|
|
// PageNode *telegraph.Page
|
|
// }
|
|
|
|
// type TaskDataType interface {
|
|
// TaskDataTGFiles | TaskDataTelegraph
|
|
// }
|
|
|
|
type Add struct {
|
|
// [TODO] maybe we should to spilit this into different types...
|
|
TaskType tasktype.TaskType
|
|
SelectedStorName string
|
|
DirID uint
|
|
SettedDir bool
|
|
// tfiles
|
|
Files []tfile.TGFileMessage
|
|
AsBatch bool
|
|
// tphpics
|
|
TphPageNode *telegraph.Page
|
|
TphPics []string
|
|
TphDirPath string // unescaped telegraph.Page.Path
|
|
// parseditem
|
|
ParsedItem *parser.Item
|
|
// directlinks
|
|
DirectLinks []string
|
|
}
|
|
|
|
type SetDefaultStorage struct {
|
|
StorageName string
|
|
DirID uint
|
|
}
|