baidu_photo

package
v0.0.0-...-094e1e4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_URL         = "https://photo.baidu.com/youai"
	USER_API_URL    = API_URL + "/user/v1"
	ALBUM_API_URL   = API_URL + "/album/v1"
	FILE_API_URL_V1 = API_URL + "/file/v1"
	FILE_API_URL_V2 = API_URL + "/file/v2"
)
View Source
const AppKey = "huREKC2eNTctaBWfh3LdiAYjZ9ARBh5g"
View Source
const SecretKey = "eMmhaLDpxzTKX3upCguM0q9yOsmVDP6g"
View Source
const UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

Variables

View Source
var (
	StatusIdle         = 0
	StatusFinished     = 1
	StatusCanceled     = 2
	StatusError        = 3
	StatusWaitRunning  = 4
	StatusWaitCanceled = 5
	StatusRunning      = 6
)
View Source
var EmptyToken = errors.New("empty token")

Functions

func ApiEvent

func ApiEvent(c echo.Context, kfsCore *core.KFS) error

func InsertDriverBaiduPhoto

func InsertDriverBaiduPhoto(ctx context.Context, kfsCore *core.KFS, name, description, code string) (bool, error)

Types

type Client

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

func (*Client) Chan

func (c *Client) Chan() chan TaskInfo

func (*Client) Message

func (c *Client) Message() TaskInfo

type DriverBaiduPhoto

type DriverBaiduPhoto struct {
	AccessToken  string
	RefreshToken string
	AppKey       string
	SecretKey    string
	// contains filtered or unexported fields
}

func GetOrLoadDriver

func GetOrLoadDriver(ctx context.Context, kfsCore *core.KFS, driverId uint64) (*DriverBaiduPhoto, error)

func LoadDriverFromDb

func LoadDriverFromDb(ctx context.Context, kfsCore *core.KFS, driverId uint64) (*DriverBaiduPhoto, error)

func (*DriverBaiduPhoto) Analyze

func (d *DriverBaiduPhoto) Analyze(ctx context.Context) (err error)

func (*DriverBaiduPhoto) Download

func (d *DriverBaiduPhoto) Download(ctx context.Context, file File, hash string) error

func (*DriverBaiduPhoto) DownloadFile

func (d *DriverBaiduPhoto) DownloadFile(ctx context.Context, name string, downloadPath string) (string, error)

func (*DriverBaiduPhoto) Get

func (d *DriverBaiduPhoto) Get(ctx context.Context, furl string, callback func(req *resty.Request), resp interface{}) error

func (*DriverBaiduPhoto) GetAllFile

func (d *DriverBaiduPhoto) GetAllFile(ctx context.Context, cb func([]File) bool) error

func (*DriverBaiduPhoto) GetDownloadPath

func (d *DriverBaiduPhoto) GetDownloadPath(ctx context.Context, fsid int64) (string, error)

func (*DriverBaiduPhoto) Request

func (d *DriverBaiduPhoto) Request(ctx context.Context, furl string, method string, callback func(req *resty.Request), resp interface{}, output string) (err error)

func (*DriverBaiduPhoto) StartOrStop

func (d *DriverBaiduPhoto) StartOrStop(ctx context.Context, start bool)

func (*DriverBaiduPhoto) WGet

func (d *DriverBaiduPhoto) WGet(ctx context.Context, furl string, output string) error

type File

type File struct {
	Fsid      int64  `json:"fsid"` // 文件ID
	Path      string `json:"path"` // 文件路径
	Size      int64  `json:"size"`
	Ctime     int64  `json:"ctime"` // 创建时间 s
	Mtime     int64  `json:"mtime"` // 修改时间 s
	Md5       string `json:"md5"`
	ShootTime int64  `json:"shoot_time"`
}

type FileListResp

type FileListResp struct {
	Page
	List []File `json:"list"`
}

type Page

type Page struct {
	HasMore int    `json:"has_more"`
	Cursor  string `json:"cursor"`
}

func (Page) HasNextPage

func (p Page) HasNextPage() bool

type TaskInfo

type TaskInfo struct {
	Status       int    `json:"status"`
	LastDoneTime int64  `json:"lastDoneTime"`
	Cnt          int    `json:"cnt"`
	Total        int    `json:"total"`
	ErrMsg       string `json:"errMsg"`
	// contains filtered or unexported fields
}

type TokenErrResp

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

func (*TokenErrResp) Error

func (e *TokenErrResp) Error() string

type TokenResp

type TokenResp struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

Jump to

Keyboard shortcuts

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