pcsconfig

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Config 配置信息, 由外部调用
	Config = NewConfig()

	// ActiveBaiduUser 当前百度帐号
	ActiveBaiduUser = new(Baidu)
)

Functions

func CheckFileExist

func CheckFileExist(path string) bool

CheckFileExist 检查本地文件是否与网盘的文件重名

func GetSavePath

func GetSavePath(path string) string

GetSavePath 根据提供的网盘文件路径 path, 返回本地储存路径, 返回绝对路径, 获取绝对路径出错时才返回相对路径...

func GetUserNameByUID

func GetUserNameByUID(uid uint64) (username string, err error)

GetUserNameByUID 通过百度uid获取百度用户名

func Init

func Init()

Init 初始化配置

func Reload

func Reload() error

Reload 从配置文件重载更新 Config

func UpdateActiveBaiduUser

func UpdateActiveBaiduUser() error

UpdateActiveBaiduUser 更新 当前百度帐号

Types

type Baidu

type Baidu struct {
	UID    uint64 `json:"uid"`
	Name   string `json:"name"`
	BDUSS  string `json:"bduss"`
	PTOKEN string `json:"ptoken"`
	STOKEN string `json:"stoken"`

	Workdir string `json:"workdir"`
}

Baidu 百度帐号对象

func NewWithBDUSS

func NewWithBDUSS(bduss string) (*Baidu, error)

NewWithBDUSS 检测BDUSS有效性, 同时获取百度详细信息

type PCSConfig

type PCSConfig struct {
	BaiduActiveUID uint64   `json:"baidu_active_uid"`
	BaiduUserList  []*Baidu `json:"baidu_user_list"`

	AppID int `json:"appid"` // appid

	CacheSize   int `json:"cache_size"`   // 下载缓存
	MaxParallel int `json:"max_parallel"` // 最大下载并发量

	UserAgent string `json:"user_agent"` // 浏览器标识
	SaveDir   string `json:"savedir"`    // 下载储存路径
}

PCSConfig 配置详情

func NewConfig

func NewConfig() *PCSConfig

NewConfig 返回 PCSConfig 指针对象

func (*PCSConfig) CheckUIDExist

func (c *PCSConfig) CheckUIDExist(uid uint64) bool

CheckUIDExist 检查 百度uid 是否存在于已登录列表

func (*PCSConfig) DeleteBaiduUserByUID

func (c *PCSConfig) DeleteBaiduUserByUID(uid uint64) bool

DeleteBaiduUserByUID 通过uid删除百度帐号

func (*PCSConfig) GetAllBaiduUser

func (c *PCSConfig) GetAllBaiduUser() string

GetAllBaiduUser 返回所有已登录百度帐号

func (*PCSConfig) GetBaiduUserByUID

func (c *PCSConfig) GetBaiduUserByUID(uid uint64) (*Baidu, error)

GetBaiduUserByUID 通过 百度uid 获取 Baidu 指针对象

func (*PCSConfig) Save

func (c *PCSConfig) Save() error

Save 保存配置信息到配置文件, 并重载配置

func (*PCSConfig) Set

func (c *PCSConfig) Set(key, value string) (err error)

func (*PCSConfig) SetBDUSS

func (c *PCSConfig) SetBDUSS(bduss, ptoken, stoken string) (username string, err error)

SetBDUSS 设置百度 bduss, ptoken, stoken 并保存

Jump to

Keyboard shortcuts

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