🐛 fix mediatrack can't mkdir #351

pull/548/head
微凉 2022-01-14 18:19:58 +08:00
parent 1640a52789
commit 55d244b726
3 changed files with 24 additions and 4 deletions

View File

@ -36,11 +36,13 @@ func (driver MediaTrack) Items() []base.Item {
Label: "Token", Label: "Token",
Type: base.TypeString, Type: base.TypeString,
Description: "Unknown expiration time", Description: "Unknown expiration time",
Required: true,
}, },
{ {
Name: "root_folder", Name: "root_folder",
Label: "root folder file_id", Label: "root folder file_id",
Type: base.TypeString, Type: base.TypeString,
Required: true,
}, },
{ {
Name: "order_by", Name: "order_by",
@ -155,7 +157,7 @@ func (driver MediaTrack) MakeDir(path string, account *model.Account) error {
if err != nil { if err != nil {
return err return err
} }
url := fmt.Sprintf("https://jayce.api.mediatrack.cn/v4/assets/%s/children", parentFile.Id) url := fmt.Sprintf("https://jayce.api.mediatrack.cn/v3/assets/%s/children", parentFile.Id)
_, err = driver.Request(url, base.Post, nil, nil, nil, base.Json{ _, err = driver.Request(url, base.Post, nil, nil, nil, base.Json{
"type": 1, "type": 1,
"title": utils.Base(path), "title": utils.Base(path),

View File

@ -8,6 +8,7 @@ import (
"github.com/Xhofe/alist/model" "github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/utils" "github.com/Xhofe/alist/utils"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
"path" "path"
"strconv" "strconv"
"time" "time"
@ -58,6 +59,7 @@ func (driver MediaTrack) Request(url string, method int, headers, query, form ma
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Debugln(res.String())
if e.Status != "SUCCESS" { if e.Status != "SUCCESS" {
return nil, errors.New(e.Message) return nil, errors.New(e.Message)
} }

View File

@ -4,6 +4,7 @@ import (
"github.com/Xhofe/alist/drivers/base" "github.com/Xhofe/alist/drivers/base"
"github.com/Xhofe/alist/model" "github.com/Xhofe/alist/model"
"github.com/Xhofe/alist/utils" "github.com/Xhofe/alist/utils"
log "github.com/sirupsen/logrus"
) )
func MakeDir(driver base.Driver, account *model.Account, path string, clearCache bool) error { func MakeDir(driver base.Driver, account *model.Account, path string, clearCache bool) error {
@ -11,6 +12,9 @@ func MakeDir(driver base.Driver, account *model.Account, path string, clearCache
if err == nil && clearCache { if err == nil && clearCache {
_ = base.DeleteCache(utils.Dir(path), account) _ = base.DeleteCache(utils.Dir(path), account)
} }
if err != nil {
log.Errorf("mkdir error: %s", err.Error())
}
return err return err
} }
@ -31,6 +35,9 @@ func Move(driver base.Driver, account *model.Account, src, dst string, clearCach
_ = base.DeleteCache(utils.Dir(dst), account) _ = base.DeleteCache(utils.Dir(dst), account)
} }
} }
if err != nil {
log.Errorf("move error: %s", err.Error())
}
return err return err
} }
@ -39,6 +46,9 @@ func Copy(driver base.Driver, account *model.Account, src, dst string, clearCach
if err == nil && clearCache { if err == nil && clearCache {
_ = base.DeleteCache(utils.Dir(dst), account) _ = base.DeleteCache(utils.Dir(dst), account)
} }
if err != nil {
log.Errorf("copy error: %s", err.Error())
}
return err return err
} }
@ -47,6 +57,9 @@ func Delete(driver base.Driver, account *model.Account, path string, clearCache
if err == nil && clearCache { if err == nil && clearCache {
_ = base.DeleteCache(utils.Dir(path), account) _ = base.DeleteCache(utils.Dir(path), account)
} }
if err != nil {
log.Errorf("delete error: %s", err.Error())
}
return err return err
} }
@ -58,5 +71,8 @@ func Upload(driver base.Driver, account *model.Account, file *model.FileStream,
if err == nil && clearCache { if err == nil && clearCache {
_ = base.DeleteCache(file.ParentPath, account) _ = base.DeleteCache(file.ParentPath, account)
} }
if err != nil {
log.Errorf("upload error: %s", err.Error())
}
return err return err
} }