baidu_photo

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QuickXorHashType hash.Type
)

Globals

Functions

func Config

func Config(ctx context.Context, name string, m configmap.Mapper, config fs.ConfigIn) (*fs.ConfigOut, error)

func NewFs

func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error)

NewFs root is linux path ,maybe "" "/" "/1/2" is not be "\1" "\\1" .root may be file path. need to fix

func SplitPath

func SplitPath(pathStr string) (dir, file string)

Types

type BaiduClient

type BaiduClient struct {
	*rest.Client
	Channel    string
	Web        string
	AppId      string
	Bdstoken   string
	LogId      string
	ClientType string
	DpLogId    string
	// contains filtered or unexported fields
}

func NewBaiduClient

func NewBaiduClient(client *rest.Client, logId string) *BaiduClient

func (*BaiduClient) AddParam

func (b *BaiduClient) AddParam(opts *rest.Opts) *rest.Opts

func (*BaiduClient) Call

func (b *BaiduClient) Call(ctx context.Context, opts *rest.Opts) (*http.Response, error)

func (*BaiduClient) CallJSON

func (b *BaiduClient) CallJSON(ctx context.Context, opts *rest.Opts, request interface{}, response ErrnoResponse) (*http.Response, error)

func (*BaiduClient) CallJSONBase

func (b *BaiduClient) CallJSONBase(ctx context.Context, opts *rest.Opts, request interface{}, response interface{}) (*http.Response, error)

func (*BaiduClient) CallJSONIgnore

func (b *BaiduClient) CallJSONIgnore(ctx context.Context, opts *rest.Opts, request interface{}, response ErrnoResponse, ignoreList []int) (*http.Response, error)

type ErrnoResponse

type ErrnoResponse interface {
	GetErrno() int
}

type Fs

type Fs struct {
	UserId  int64  // ID to use for querying Microsoft Graph
	VipType string // https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/drive
	// contains filtered or unexported fields
}

Fs represents a remote

func (*Fs) About

func (f *Fs) About(ctx context.Context) (*fs.Usage, error)

func (*Fs) BaseItemToDirOrObject

func (f *Fs) BaseItemToDirOrObject(info *api.BaseItem) (entry *Object, err error)

func (*Fs) Copy

func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, error)

Copy src to this remote using server-side copy operations.

This is stored with the remote path given.

It returns the destination Object and a possible error.

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantCopy

func (*Fs) Create

func (f *Fs) Create(ctx context.Context, path string, preCreateFileData *api.PreCreateFileData, uploadId string) (info *api.CreateVO, err error)

Create {"ctime":1713679787,"from_type":1,"fs_id":908199638643457,"isdir":0,"md5":"cd46789bbnf14a0f4de795dd13a70ca3","mtime":1713679787,"path":"/test/999/111/8e3dc4f3a75d1e13f428a1dd15e57fb7.png","size":30051726,"errno":0,"name":"\/test\/999\/111\/8e3dc4f3a75d1e13f428a1dd15e57fb7.png","category":3}

func (*Fs) CreateDir

func (f *Fs) CreateDir(ctx context.Context, pathID, leaf string) (newID string, err error)

func (*Fs) CreateDirForce

func (f *Fs) CreateDirForce(ctx context.Context, path string) (err error)

CreateDirForce force to create file ,if exists , not do anything

func (*Fs) DeleteDirOrFile

func (f *Fs) DeleteDirOrFile(ctx context.Context, fileIdPath string) (err error)

func (*Fs) DeleteDirsOrFiles

func (f *Fs) DeleteDirsOrFiles(ctx context.Context, fileIdList []string) (err error)

func (*Fs) DirMove

func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string) error

DirMove moves src, srcRemote to this remote at dstRemote using server-side move operations.

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantDirMove

If destination exists then return fs.ErrorDirExists

srcRemote is absolute path,dstRemote is absolute path,can not end with "/"

func (*Fs) DownFile

func (f *Fs) DownFile(ctx context.Context, path string, size int64, options []fs.OpenOption) (in io.ReadCloser, err error)

有多少切片就开多少线程去下载

func (*Fs) DownFileDisguiseBaiduClient

func (f *Fs) DownFileDisguiseBaiduClient(ctx context.Context, path string, options []fs.OpenOption) (resp *http.Response, err error)

func (*Fs) DownFileFromId

func (f *Fs) DownFileFromId(ctx context.Context, id string, beginIndex int64, endIndex int64) (in io.ReadCloser, err error)

串行执行

func (*Fs) DownFileRapid

func (f *Fs) DownFileRapid(ctx context.Context, fileFragInfo fs.FileFragInfo, beginIndex int64, endIndex int64) (in io.ReadCloser, err error)

func (*Fs) DownFileResponse

func (f *Fs) DownFileResponse(ctx context.Context, downUrl string, beginIndex int64, endIndex int64) (resp *http.Response, err error)

DownFileBySlice 手机app设定的分片值为32768,或许可以设置更大一些,需要测试

func (*Fs) DownFileSe

func (f *Fs) DownFileSe(ctx context.Context, path string, size int64, options []fs.OpenOption) (in io.ReadCloser, err error)

固定线程去下载

func (*Fs) Features

func (f *Fs) Features() *fs.Features

Features returns the optional features of this Fs

func (*Fs) FindLeaf

func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error)

func (*Fs) GetDownUrl

func (f *Fs) GetDownUrl(ctx context.Context, id string) (url string, err error)

func (*Fs) GetFileMeta

func (f *Fs) GetFileMeta(ctx context.Context, filePath string) (item *api.Item, err error)

GetFileMeta 返回单个文件或文件夹信息,经过处理

func (*Fs) GetFileMetas

func (f *Fs) GetFileMetas(ctx context.Context, path []string, needDownLink bool, needTextLink bool) (itemList []*api.Item, resp *http.Response, err error)

GetFileMetas 返回多个文件或文件夹信息(注意是path只能一一对应,并且无法获取到时不会报错,而是返回的info里没有对应的文件或文件夹时errno为-9,外层为0)

func (*Fs) GetQuotaInfo

func (f *Fs) GetQuotaInfo(ctx context.Context) (*api.QuotaInfoResponse, error)

func (*Fs) GetUserInfo

func (f *Fs) GetUserInfo(ctx context.Context) (*api.UserInfo, error)

func (*Fs) Hashes

func (f *Fs) Hashes() hash.Set

Hashes returns the supported hash sets.

func (*Fs) List

func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error)

List entries normal need to implement fs.Directory or fs.Object ,dir is relative path.

func (*Fs) ListDirAllFiles

func (f *Fs) ListDirAllFiles(ctx context.Context) (itemList []*api.Item, err error)

func (*Fs) ListDirFilesPage

func (f *Fs) ListDirFilesPage(ctx context.Context, cursor string) (listRes *api.ListResponse, resp *http.Response, err error)

func (*Fs) Mkdir

func (f *Fs) Mkdir(ctx context.Context, dir string) error

func (*Fs) Move

func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object, error)

Move src to this remote using server-side move operations.

This is stored with the remote path given.

It returns the destination Object and a possible error.

Will only be called if src.Fs().Name() == f.Name()

If it isn't possible then return fs.ErrorCantMove

func (*Fs) MoveOrCopyDirOrFile

func (f *Fs) MoveOrCopyDirOrFile(ctx context.Context, fileParamList api.FileManagerParam, operate api.Operate) (err error)

func (*Fs) MoveOrCopyDirsOrFiles

func (f *Fs) MoveOrCopyDirsOrFiles(ctx context.Context, fileParamList []api.FileManagerParam, operate api.Operate) (err error)

func (*Fs) Name

func (f *Fs) Name() string

Name of the remote (as passed into NewFs)

func (*Fs) NewObject

func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error)

NewObject finds the Object at remote. If it can't be found it returns the error fs.ErrorObjectNotFound.

func (*Fs) PreCreate

func (f *Fs) PreCreate(ctx context.Context, reader *readers.RepeatableReader, localCtime int64, localMtime int64, size int64, path string) (preCreateFileData *api.PreCreateFileData, info *api.PreCreateVO, baseItem *api.BaseItem, err error)

PreCreate {"path":"/test/999/111/1234.exe","return_type":1,"block_list":["5910a591dd8fc18c32a8f3df4fdc1761","a5fc157d78e6ad1c7e114b056c92821e"],"errno":0,"request_id":278285463311322051} { "return_type": 2, "errno": 0, "info": { "md5": "5ddc05b01g7f6ae7d6adc90d912c983d", "category": 6, "fs_id": 166064416325948, "request_id": 280244028406040000, "from_type": 1, "size": 112060240, "isdir": 0, "mtime": 1713672326, "ctime": 1713672326, "path": "/test/999/111/1234_20240421_120525.exe" }, "request_id": 280244028406040573 } return_type 1 无法秒传,准备上传 2 秒传成功 3 文件已存在(仅一刻相册,在百度网盘中只会返回2)

func (*Fs) Precision

func (f *Fs) Precision() time.Duration

Precision return the precision of this Fs

func (*Fs) Put

func (f *Fs) Put(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error)

Put in to the remote path with the modTime given of the given size

When called from outside an Fs by rclone, src.Size() will always be >= 0. But for unknown-sized objects (indicated by src.Size() == -1), Put should either return an error or upload it properly (rather than e.g. calling panic).

May create the object even if it returns an error - if so will return the object and the error, otherwise will return nil and the error

func (*Fs) Rapid

func (f *Fs) Rapid(ctx context.Context, path string, preCreateFileData *api.PreCreateFileData, uploadId string) (baseItem *api.BaseItem, success bool, err error)

Rapid fs.ErrorFileRapidUpload

func (*Fs) RemoveFileFromId

func (f *Fs) RemoveFileFromId(ctx context.Context, fileId string, size int64) error

func (*Fs) RenameDirOrFile

func (f *Fs) RenameDirOrFile(ctx context.Context, fileParamList api.FileManagerParam) (err error)

func (*Fs) RenameDirsOrFiles

func (f *Fs) RenameDirsOrFiles(ctx context.Context, fileParamList []api.FileManagerParam) (err error)

func (*Fs) Rmdir

func (f *Fs) Rmdir(ctx context.Context, dir string) error

func (*Fs) Root

func (f *Fs) Root() string

Root of the remote (as passed into NewFs)

func (*Fs) String

func (f *Fs) String() string

String converts this Fs to a string

func (*Fs) ToAbsoluteFilePath

func (f *Fs) ToAbsoluteFilePath(relativePath string, fileName string) string

func (*Fs) ToAbsolutePath

func (f *Fs) ToAbsolutePath(relativePath string) string

func (*Fs) ToRelativeFilePath

func (f *Fs) ToRelativeFilePath(relativePath string, fileName string) string

func (*Fs) UploadFile

func (f *Fs) UploadFile(ctx context.Context, in io.Reader, localCtime int64, localMtime int64, size int64, path string) (*api.BaseItem, *api.PreCreateFileData, error)

func (*Fs) UploadFileReturnId

func (f *Fs) UploadFileReturnId(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, string, error)

func (*Fs) UploadFileReturnRapidInfo

func (f *Fs) UploadFileReturnRapidInfo(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (*fs.FileFragInfo, fs.Object, error)

type Object

type Object struct {
	// contains filtered or unexported fields
}

Object describes a OneDrive object

Will definitely have info but maybe not meta

func (*Object) Fs

func (o *Object) Fs() fs.Info

Fs returns the parent Fs

func (*Object) Hash

func (o *Object) Hash(ctx context.Context, t hash.Type) (string, error)

Hash returns the SHA-1 of an object returning a lowercase hex string

func (*Object) ID

func (o *Object) ID() string

ID returns the ID of the Object if known, or "" if not

func (*Object) MimeType

func (o *Object) MimeType(ctx context.Context) string

MimeType of an Object if known, "" otherwise

func (*Object) ModTime

func (o *Object) ModTime(ctx context.Context) time.Time

ModTime returns the modification time of the object

It attempts to read the objects mtime and if that isn't present the LastModified returned in the http headers

func (*Object) Open

func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.ReadCloser, err error)

func (*Object) OpenOld

func (o *Object) OpenOld(ctx context.Context, options ...fs.OpenOption) (in io.ReadCloser, err error)

Open an object for read

func (*Object) Remote

func (o *Object) Remote() string

Remote returns the remote path

func (*Object) Remove

func (o *Object) Remove(ctx context.Context) error

Remove an object

func (*Object) SetModTime

func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error

SetModTime sets the modification time of the local fs object

func (*Object) Size

func (o *Object) Size() int64

Size returns the size of an object in bytes

func (*Object) Storable

func (o *Object) Storable() bool

Storable returns a boolean showing whether this object storable

func (*Object) String

func (o *Object) String() string

Return a string version

func (*Object) Update

func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (err error)

Update the object with the contents of the io.Reader, modTime and size

The new object may have been created if an error is returned

type Options

type Options struct {
	Region                  string               `config:"region"`
	ChunkSize               fs.SizeSuffix        `config:"chunk_size"`
	UserID                  int64                `config:"drive_id"`
	VipType                 string               `config:"drive_type"`
	RootFolderID            string               `config:"root_folder_id"`
	DisableSitePermission   bool                 `config:"disable_site_permission"`
	AccessScopes            fs.SpaceSepList      `config:"access_scopes"`
	ExposeOneNoteFiles      bool                 `config:"expose_onenote_files"`
	ServerSideAcrossConfigs bool                 `config:"server_side_across_configs"`
	ListChunk               int64                `config:"list_chunk"`
	NoVersions              bool                 `config:"no_versions"`
	LinkScope               string               `config:"link_scope"`
	LinkType                string               `config:"link_type"`
	LinkPassword            string               `config:"link_password"`
	HashType                string               `config:"hash_type"`
	AVOverride              bool                 `config:"av_override"`
	Delta                   bool                 `config:"delta"`
	Enc                     encoder.MultiEncoder `config:"encoding"`
}

Options defines the configuration for this backend

type TaskResult

type TaskResult struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package quickxorhash provides the quickXorHash algorithm which is a quick, simple non-cryptographic hash algorithm that works by XORing the bytes in a circular-shifting fashion.
Package quickxorhash provides the quickXorHash algorithm which is a quick, simple non-cryptographic hash algorithm that works by XORing the bytes in a circular-shifting fashion.

Jump to

Keyboard shortcuts

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