qbit

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeTorrentHash

func ComputeTorrentHash(data []byte) (string, error)

ComputeTorrentHash 计算种子的 SHA1 哈希值

func ComputeTorrentHashWithPath

func ComputeTorrentHashWithPath(filePath string) (string, error)

func GetTorrentFilesPath

func GetTorrentFilesPath(directory string) ([]string, error)

获取目录中所有种子文件

Types

type QbitClient

type QbitClient struct {
	BaseURL     string
	Username    string
	Password    string
	Client      *http.Client
	RateLimiter *time.Ticker
	// contains filtered or unexported fields
}

func NewQbitClient

func NewQbitClient(baseURL, username, password string, rateLimit time.Duration) (*QbitClient, error)

func (*QbitClient) AddTorrent

func (q *QbitClient) AddTorrent(fileData []byte, category, tags string) error

func (*QbitClient) CanAddTorrent

func (q *QbitClient) CanAddTorrent(ctx context.Context, fileSize int64) (bool, error)

func (*QbitClient) CheckTorrentExists

func (q *QbitClient) CheckTorrentExists(torrentHash string) (bool, error)

CheckTorrentExists 检查种子是否存在

func (*QbitClient) DoRequestWithRetry added in v0.0.8

func (q *QbitClient) DoRequestWithRetry(req *http.Request) (*http.Response, error)

func (*QbitClient) GetDiskSpace

func (q *QbitClient) GetDiskSpace(c context.Context) (int64, error)

func (*QbitClient) GetLastAddedTorrentTime

func (q *QbitClient) GetLastAddedTorrentTime() (time.Time, error)

func (*QbitClient) ProcessSingleTorrentFile

func (q *QbitClient) ProcessSingleTorrentFile(ctx context.Context, filePath, category, tags string) error

func (*QbitClient) ProcessTorrentDirectory

func (q *QbitClient) ProcessTorrentDirectory(ctx context.Context, directory string, category, tags string) error

type QbitTorrentProperties

type QbitTorrentProperties struct {
	SavePath               string  `json:"save_path"`
	CreationDate           int64   `json:"creation_date"`
	PieceSize              int64   `json:"piece_size"`
	Comment                string  `json:"comment"`
	TotalWasted            int64   `json:"total_wasted"`
	TotalUploaded          int64   `json:"total_uploaded"`
	TotalUploadedSession   int64   `json:"total_uploaded_session"`
	TotalDownloaded        int64   `json:"total_downloaded"`
	TotalDownloadedSession int64   `json:"total_downloaded_session"`
	UploadLimit            int64   `json:"up_limit"`
	DownloadLimit          int64   `json:"dl_limit"`
	TimeElapsed            int64   `json:"time_elapsed"`
	SeedingTime            int64   `json:"seeding_time"`
	NumConnections         int     `json:"nb_connections"`
	NumConnectionsLimit    int     `json:"nb_connections_limit"`
	ShareRatio             float64 `json:"share_ratio"`
	AdditionDate           int64   `json:"addition_date"`
	CompletionDate         int64   `json:"completion_date"`
	CreatedBy              string  `json:"created_by"`
	AverageDownloadSpeed   int64   `json:"dl_speed_avg"`
	DownloadSpeed          int64   `json:"dl_speed"`
	ETA                    int64   `json:"eta"`
	LastSeen               int64   `json:"last_seen"`
	Peers                  int     `json:"peers"`
	PeersTotal             int     `json:"peers_total"`
	PiecesHave             int     `json:"pieces_have"`
	PiecesNum              int     `json:"pieces_num"`
	Reannounce             int64   `json:"reannounce"`
	Seeds                  int     `json:"seeds"`
	SeedsTotal             int     `json:"seeds_total"`
	TotalSize              int64   `json:"total_size"`
	AverageUploadSpeed     int64   `json:"up_speed_avg"`
	UploadSpeed            int64   `json:"up_speed"`
	IsPrivate              bool    `json:"isPrivate"`
}

Jump to

Keyboard shortcuts

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