baidu_netdisk

package
v3.35.2-8Mi Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSliceSize int64 = 4 * utils.MB
	VipSliceSize           = 16 * utils.MB
	SVipSliceSize          = 32 * utils.MB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Addition

type Addition struct {
	RefreshToken string `json:"refresh_token" required:"true"`
	driver.RootPath
	OrderBy              string `json:"order_by" type:"select" options:"name,time,size" default:"name"`
	OrderDirection       string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
	DownloadAPI          string `json:"download_api" type:"select" options:"official,crack" default:"official"`
	ClientID             string `json:"client_id" required:"true" default:"iYCeC9g08h5vuP9UqvPHKKSVrKFXGa1v"`
	ClientSecret         string `json:"client_secret" required:"true" default:"jXiFMOPVPCWlO2M5CwWQzffpNPaGTRBG"`
	CustomCrackUA        string `json:"custom_crack_ua" required:"true" default:"netdisk"`
	AccessToken          string
	UploadThread         string `json:"upload_thread" default:"3" help:"1<=thread<=32"`
	UploadAPI            string `json:"upload_api" default:"https://d.pcs.baidu.com"`
	CustomUploadPartSize int64  `json:"custom_upload_part_size" type:"number" default:"0" help:"0 for auto"`
}

type BaiduNetdisk

type BaiduNetdisk struct {
	model.Storage
	Addition
	// contains filtered or unexported fields
}

func (*BaiduNetdisk) Config

func (d *BaiduNetdisk) Config() driver.Config

func (*BaiduNetdisk) Copy

func (d *BaiduNetdisk) Copy(ctx context.Context, srcObj, dstDir model.Obj) error

func (*BaiduNetdisk) Drop

func (d *BaiduNetdisk) Drop(ctx context.Context) error

func (*BaiduNetdisk) GetAddition

func (d *BaiduNetdisk) GetAddition() driver.Additional

func (*BaiduNetdisk) Init

func (d *BaiduNetdisk) Init(ctx context.Context) error
func (d *BaiduNetdisk) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*BaiduNetdisk) List

func (d *BaiduNetdisk) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

func (*BaiduNetdisk) MakeDir

func (d *BaiduNetdisk) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error)

func (*BaiduNetdisk) Move

func (d *BaiduNetdisk) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)

func (*BaiduNetdisk) Put

Put

**注意**: 截至 2024/04/20 百度云盘 api 接口返回的时间永远是当前时间,而不是文件时间。 而实际上云盘存储的时间是文件时间,所以此处需要覆盖时间,保证缓存与云盘的数据一致

func (*BaiduNetdisk) PutRapid

func (d *BaiduNetdisk) PutRapid(ctx context.Context, dstDir model.Obj, stream model.FileStreamer) (model.Obj, error)

func (*BaiduNetdisk) Remove

func (d *BaiduNetdisk) Remove(ctx context.Context, obj model.Obj) error

func (*BaiduNetdisk) Rename

func (d *BaiduNetdisk) Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error)

type DownloadResp

type DownloadResp struct {
	Errmsg string `json:"errmsg"`
	Errno  int    `json:"errno"`
	List   []struct {
		//Category    int    `json:"category"`
		//DateTaken   int    `json:"date_taken,omitempty"`
		Dlink string `json:"dlink"`
	} `json:"list"`
	//Names struct {
	//} `json:"names"`
	RequestId string `json:"request_id"`
}

type DownloadResp2

type DownloadResp2 struct {
	Errno int `json:"errno"`
	Info  []struct {
		//ExtentTinyint4 int `json:"extent_tinyint4"`
		//ExtentTinyint1 int `json:"extent_tinyint1"`
		//Bitmap string `json:"bitmap"`
		//Category int `json:"category"`
		//Isdir int `json:"isdir"`
		//Videotag int `json:"videotag"`
		Dlink string `json:"dlink"`
	} `json:"info"`
	RequestID int64 `json:"request_id"`
}

type File

type File struct {
	//TkbindId     int    `json:"tkbind_id"`
	//OwnerType    int    `json:"owner_type"`
	//Category     int    `json:"category"`
	//RealCategory string `json:"real_category"`
	FsId int64 `json:"fs_id"`
	//OperId      int   `json:"oper_id"`
	Thumbs struct {
		//Icon string `json:"icon"`
		Url3 string `json:"url3"`
	} `json:"thumbs"`

	Size int64 `json:"size"`
	//ExtentTinyint7 int    `json:"extent_tinyint7"`
	Path string `json:"path"`
	//Share          int    `json:"share"`
	//Pl             int    `json:"pl"`
	ServerFilename string `json:"server_filename"`
	Md5            string `json:"md5"`
	//OwnerId        int    `json:"owner_id"`
	//Unlist int `json:"unlist"`
	Isdir int `json:"isdir"`

	// list resp
	ServerCtime int64 `json:"server_ctime"`
	ServerMtime int64 `json:"server_mtime"`
	LocalMtime  int64 `json:"local_mtime"`
	LocalCtime  int64 `json:"local_ctime"`

	// only create and precreate resp
	Ctime int64 `json:"ctime"`
	Mtime int64 `json:"mtime"`
}

type ListResp

type ListResp struct {
	Errno     int    `json:"errno"`
	GuidInfo  string `json:"guid_info"`
	List      []File `json:"list"`
	RequestId int64  `json:"request_id"`
	Guid      int    `json:"guid"`
}

type PrecreateResp

type PrecreateResp struct {
	Errno      int   `json:"errno"`
	RequestId  int64 `json:"request_id"`
	ReturnType int   `json:"return_type"`

	// return_type=1
	Path      string `json:"path"`
	Uploadid  string `json:"uploadid"`
	BlockList []int  `json:"block_list"`

	// return_type=2
	File File `json:"info"`
}

type TokenErrResp

type TokenErrResp struct {
	ErrorDescription string `json:"error_description"`
	Error            string `json:"error"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL