mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-09-05 15:46:37 +08:00
refactor: update file handling to use new downloader interface; remove unused tdler package
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package tfile
|
||||
|
||||
import (
|
||||
"github.com/gotd/td/telegram/downloader"
|
||||
"github.com/krau/SaveAny-Bot/common/utils/dlutil"
|
||||
"github.com/krau/SaveAny-Bot/config"
|
||||
"github.com/krau/SaveAny-Bot/pkg/consts/tglimit"
|
||||
)
|
||||
|
||||
type DlerClient interface {
|
||||
downloader.Client
|
||||
}
|
||||
|
||||
func NewDownloader(file TGFile) *downloader.Builder {
|
||||
return downloader.NewDownloader().WithPartSize(tglimit.MaxPartSize).
|
||||
Download(file.Dler(), file.Location()).WithThreads(dlutil.BestThreads(file.Size(), config.Cfg.Threads))
|
||||
}
|
||||
Reference in New Issue
Block a user