protocol

package
v0.0.0-...-63590f1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2016 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBatchTasks

func AddBatchTasks(urls []string, oids ...string) error

func AddBatchTasksAsync

func AddBatchTasksAsync(req []string, callback func(error), oids ...string)

func AddTask

func AddTask(req string) error

func AddTaskAsync

func AddTaskAsync(req string, callback func(error))

func DelayAllTasks

func DelayAllTasks() error

func DelayAllTasksAsync

func DelayAllTasksAsync(callback func(error))

func DelayTask

func DelayTask(t *Task) error

func DelayTaskAsync

func DelayTaskAsync(id string, callback func(error))

func DelayTaskById

func DelayTaskById(taskid string) error

func DeleteTask

func DeleteTask(t *Task) error

func DeleteTaskAsync

func DeleteTaskAsync(id string, callback func(error))

func DeleteTaskById

func DeleteTaskById(taskid string) error

func EncryptPass

func EncryptPass(pass string) string

func FillBtList

func FillBtList(t *Task) (*btList, error)

func FillBtListAsync

func FillBtListAsync(taskid, infohash string, callback func(*btList, error))

func FillBtListById

func FillBtListById(taskid, infohash string) (*btList, error)

func FindTasks

func FindTasks(pattern string) (map[string]*Task, error)

func GetCompletedTasksAsync

func GetCompletedTasksAsync(callback func([]*Task, error))

func GetDeletedTasksAsync

func GetDeletedTasksAsync(callback func([]*Task, error))

func GetExpiredTasksAsync

func GetExpiredTasksAsync(callback func([]*Task, error))

func GetGdriveId

func GetGdriveId() (gid string, err error)

func GetGdriveIdAsync

func GetGdriveIdAsync(callback func(string, error))

func GetIncompletedTasksAsync

func GetIncompletedTasksAsync(callback func([]*Task, error))

func GetTasksAsync

func GetTasksAsync(callback func([]*Task, error))

func GetTasksByIds

func GetTasksByIds(ids []string) map[string]*Task

func GetTorrentByHash

func GetTorrentByHash(hash string) ([]byte, error)

func GetTorrentByHashAsync

func GetTorrentByHashAsync(hash string, callback func([]byte, error))

func GetTorrentFileByHash

func GetTorrentFileByHash(hash, file string) error

func InvalidateCache

func InvalidateCache(flag byte)

func InvalidateCacheAll

func InvalidateCacheAll()

func IsOn

func IsOn() bool

func Login

func Login(id, passhash string) (err error)

func PauseTask

func PauseTask(t *Task) error

func PauseTasks

func PauseTasks(ids []string) error

func PauseTasksAsync

func PauseTasksAsync(ids []string, callback func(error))

func ProcessTask

func ProcessTask(callback TaskCallback) error

func ProcessTaskDaemon

func ProcessTaskDaemon(ch chan byte, callback TaskCallback)

func PurgeTask

func PurgeTask(t *Task) error

func PurgeTaskAsync

func PurgeTaskAsync(id string, callback func(error))

func PurgeTaskById

func PurgeTaskById(taskid string) error

func RawFillBtList

func RawFillBtList(t *Task, page int) ([]byte, error)

func RawFillBtListById

func RawFillBtListById(taskid, infohash string, page int) ([]byte, error)

func RawTaskList

func RawTaskList(category, page int) ([]byte, error)

func RawTaskListDeleted

func RawTaskListDeleted(page int) ([]byte, error)

func RawTaskListExpired

func RawTaskListExpired() ([]byte, error)

func ReAddTask

func ReAddTask(t *Task) error

func ReAddTasks

func ReAddTasks(ts map[string]*Task)

func RenameTask

func RenameTask(t *Task, newname string) error

func RenameTaskAsync

func RenameTaskAsync(id, name string, callback func(error))

func RenameTaskById

func RenameTaskById(taskid, newname string) error

func ResumeSession

func ResumeSession(cookieFile string) (err error)

func ResumeTask

func ResumeTask(t *Task) error

func ResumeTaskAsync

func ResumeTaskAsync(id string, callback func(error))

func ResumeTaskById

func ResumeTaskById(taskid string) error

func SaveSession

func SaveSession(cookieFile string) error

func VerifyTask

func VerifyTask(t *Task, path string) bool

Types

type ErrorMessage

type ErrorMessage struct {
	Code    json.RawMessage `json:"rtcode,omitempty"`
	Message string          `json:"msg,omitempty"`
}

type Session

type Session interface {
	Login(id, passhash string) (err error)
	SaveSession(cookieFile string) error
	ResumeSession(cookieFile string) (err error)
	Account() (ua *UserAccount)
	IsOn() bool
	GetTasks(limit ...int) ([]*Task, error)
	GetCompletedTasks() ([]*Task, error)
	GetIncompletedTasks() ([]*Task, error)
	GetGdriveId() (gid string, err error)
	RawTaskList(category, page int) ([]byte, error)
	RawTaskListExpired() ([]byte, error)
	RawTaskListDeleted(page int) ([]byte, error)
	GetExpiredTasks() ([]*Task, error)
	GetDeletedTasks() ([]*Task, error)
	DelayTask(t *Task) error
	DelayTaskById(taskid string) error
	FillBtList(t *Task) (*btList, error)
	FillBtListById(taskid, infohash string) (*btList, error)
	RawFillBtList(t *Task, page int) ([]byte, error)
	RawFillBtListById(taskid, infohash string, page int) ([]byte, error)
	AddTask(req string) error
	AddBatchTasks(urls []string, oids ...string) error
	ProcessTaskDaemon(ch chan byte, callback TaskCallback)
	ProcessTask(callback TaskCallback) error
	GetTorrentByHash(hash string) ([]byte, error)
	GetTorrentFileByHash(hash, file string) error
	PauseTask(t *Task) error
	PauseTasks(ids []string) error
	DelayAllTasks() error
	ReAddTask(t *Task) error
	ReAddTasks(ts map[string]*Task)
	RenameTask(t *Task, newname string) error
	RenameTaskById(taskid, newname string) error
	ResumeTask(t *Task) error
	ResumeTaskById(taskid string) error
	DeleteTask(t *Task) error
	DeleteTaskById(taskid string) error
	PurgeTask(t *Task) error
	PurgeTaskById(taskid string) error
	VerifyTask(t *Task, path string) bool
	FindTasks(pattern string) (map[string]*Task, error)
	GetTaskById(taskid string) (t *Task, exist bool)
	GetTasksByIds(ids []string) map[string]*Task
	InvalidateCache(flag byte)
	InvalidateCacheAll()
}

func NewSession

func NewSession(timeout time.Duration) Session

type Task

type Task struct {
	Id   string `json:"id"`
	Flag string `json:"flag"`
	// Database            string `json:"database"`
	// ClassValue          string `json:"class_value"`
	GlobalId       string  `json:"global_id"`
	ResType        string  `json:"restype"`
	FileSize       string  `json:"filesize"`
	FileType       string  `json:"filetype"`
	Cid            string  `json:"cid"`
	GCid           string  `json:"gcid"`
	TaskName       string  `json:"taskname"`
	DownloadStatus string  `json:"download_status"`
	Speed          string  `json:"speed"`
	Progress       float32 `json:"progress"`
	// UsedTime            string `json:"used_time"`
	LeftLiveTime string `json:"left_live_time"`
	LixianURL    string `json:"lixian_url"`
	URL          string `json:"url"`
	ReferURL     string `json:"refer_url"`
	Cookie       string `json:"cookie"`
	// Vod                 string `json:"vod"`
	Status string `json:"status"`
	// Message             string `json:"message"`
	// DtCommitted         string `json:"dt_committed"`
	// DtDeleted           string `json:"dt_deleted"`
	// ListSum             string `json:"list_sum"`
	// FinishSum           string `json:"finish_sum"`
	// FlagKilledInASecond string `json:"flag_killed_in_a_second"`
	// ResCount            string `json:"res_count"`
	// UsingResCount       string `json:"using_res_count"`
	// VerifyFlag          string `json:"verify_flag"`
	// VerifyTime          string `json:"verify_time"`
	// ProgressText 			 string `json:"progress_text"`
	// ProgressImg         string `json:"progress_img"`
	// ProgressClass       string `json:"progress_class"`
	LeftTime string `json:"left_time"`
	UserId   int    `json:"userid"`
	// OpenFormat string `json:"openformat"`
	// TaskNameShow        string `json:"taskname_show"`
	// Ext                 string `json:"ext"`
	// ExtShow             string `json:"ext_show"`
	TaskType byte `json:"tasktype"`
	// FormatImg           string `json:"format_img"`
	// ResCountDegree      byte   `json:"res_count_degree"`
	YsFileSize string `json:"ysfilesize"`
	// BtMovie             byte   `json:"bt_movie"`
	UserType string `json:"user_type"`
}

func GetCompletedTasks

func GetCompletedTasks() ([]*Task, error)

func GetDeletedTasks

func GetDeletedTasks() ([]*Task, error)

func GetExpiredTasks

func GetExpiredTasks() ([]*Task, error)

func GetIncompletedTasks

func GetIncompletedTasks() ([]*Task, error)

func GetTaskById

func GetTaskById(taskid string) (t *Task, exist bool)

func GetTasks

func GetTasks(limit ...int) ([]*Task, error)

func (Task) Coloring

func (t Task) Coloring() string

func (Task) IsBt

func (t Task) IsBt() bool

func (Task) Repr

func (t Task) Repr() string

func (Task) String

func (t Task) String() string

type TaskCallback

type TaskCallback func(*Task) error

type UserAccount

type UserAccount struct {
	ExpireDate          string `json:"expire_date"`
	MaxTaskNum          string `json:"max_task_num"`
	MaxStore            string `json:"max_store"`
	VipStore            string `json:"vip_store"`
	BuyStore            string `json:"buy_store"`
	XzStore             string `json:"xz_store"`
	BuyNumTask          string `json:"buy_num_task"`
	BuyNumConn          string `json:"buy_num_connection"`
	BuyBandwith         string `json:"buy_bandwidth"`
	BuyTaskLiveTime     string `json:"buy_task_live_time"`
	XpExpireDate        string `json:"experience_expire_date"`
	AvailableSpace      string `json:"available_space"`
	TotalNum            string `json:"total_num"`
	HistoryTaskTotalNum string `json:"history_task_total_num"`
	SuspendingNum       string `json:"suspending_num"`
	DownloadingNum      string `json:"downloading_num"`
	WaitingNum          string `json:"waiting_num"`
	CompleteNum         string `json:"complete_num"`
	StorePeriod         string `json:"store_period"`
	Cookie              string `json:"cookie"`
	VipLevel            string `json:"vip_level"`
	UserType            string `json:"user_type"`
	GoldbeanNum         string `json:"goldbean_num"`
	ConvertFlag         string `json:"convert_flag"`
	SilverbeanNum       string `json:"silverbean_num"`
	SpecialNet          string `json:"special_net"`
	TotalFilterNum      string `json:"total_filter_num"`
}

func GetAccount

func GetAccount() *UserAccount

type UserInfo

type UserInfo struct {
	AllSpace       string `json:"all_space"`
	AllUsedStore   int64  `json:"all_used_store"`
	AllSpaceFormat string `json:"all_space_format"`
	AllUsedFormat  string `json:"all_used_format"`
	Isp            bool   `json:"isp"`
	Percent        string `json:"percent"`
}

Jump to

Keyboard shortcuts

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