Documentation
¶
Index ¶
- Variables
- func ClientExists(name string) bool
- func Exit()
- func GenerateNameWithMeta(name string, meta map[string](int64)) string
- func GenerateTorrentTagFromCategory(category string) string
- func GenerateTorrentTagFromMetadata(name string, value int64) string
- func GenerateTorrentTagFromSite(site string) string
- func IsSubstituteTag(tag string) bool
- func IsValidInfoHash(infoHash string) bool
- func IsValidInfoHashOrStateFilter(stateFilter string) bool
- func ParseMetaFromName(fullname string) (name string, meta map[string](int64))
- func PrintTorrent(torrent *Torrent)
- func PrintTorrentFiles(files []TorrentContentFile, showRaw bool)
- func PrintTorrentTrackers(trackers TorrentTrackers)
- func PrintTorrents(torrents []Torrent, filter string, showSum int64)
- func Purge(clientName string)
- func Register(regInfo *RegInfo)
- func SelectTorrents(clientInstance Client, category string, tag string, filter string, ...) ([]string, error)
- type Client
- type ClientCreator
- type RegInfo
- type Status
- type Torrent
- func (torrent *Torrent) GetCategoryFromTag() string
- func (torrent *Torrent) GetMetaFromTag(meta string) string
- func (torrent *Torrent) GetMetadataFromTags() map[string](int64)
- func (torrent *Torrent) GetSiteFromTag() string
- func (torrent *Torrent) HasTag(tag string) bool
- func (torrent *Torrent) IsComplete() bool
- func (torrent *Torrent) IsFull() bool
- func (torrent *Torrent) IsFullComplete() bool
- func (torrent *Torrent) MatchStateFilter(stateFilter string) bool
- func (torrent *Torrent) RemoveSubstituteTags()
- func (torrent *Torrent) StateIconText() string
- type TorrentCategory
- type TorrentContentFile
- type TorrentOption
- type TorrentTracker
- type TorrentTrackers
Constants ¶
This section is empty.
Variables ¶
View Source
var ( STATES = []string{"seeding", "downloading", "completed", "paused", "checking", "error", "unknown"} STATE_FILTERS = []string{"_all", "_active", "_done", "_undone"} Registry = []*RegInfo{} )
Functions ¶
func ClientExists ¶
func GenerateTorrentTagFromCategory ¶ added in v0.1.2
func GenerateTorrentTagFromMetadata ¶ added in v0.1.5
func IsSubstituteTag ¶ added in v0.1.5
func IsValidInfoHash ¶ added in v0.1.2
func IsValidInfoHashOrStateFilter ¶ added in v0.1.2
func ParseMetaFromName ¶
func PrintTorrent ¶ added in v0.1.1
func PrintTorrent(torrent *Torrent)
func PrintTorrentFiles ¶ added in v0.1.1
func PrintTorrentFiles(files []TorrentContentFile, showRaw bool)
func PrintTorrentTrackers ¶ added in v0.1.1
func PrintTorrentTrackers(trackers TorrentTrackers)
func PrintTorrents ¶
showSum: 0 - no; 1 - yes; 2 - sum only
func SelectTorrents ¶ added in v0.1.1
func SelectTorrents(clientInstance Client, category string, tag string, filter string, hashOrStateFilters ...string) ([]string, error)
parse torrents that meet criterion and return infoHashes. specially, return nil slice if all torrents selected tag: comma-separated list, a torrent will match if it has any tag that in the list
Types ¶
type Client ¶
type Client interface {
GetTorrent(infoHash string) (*Torrent, error)
// stateFilter: _all|_active|_done|_undone, or any state value (possibly with a _ prefix)
GetTorrents(stateFilter string, category string, showAll bool) ([]Torrent, error)
AddTorrent(torrentContent []byte, option *TorrentOption, meta map[string](int64)) error
ModifyTorrent(infoHash string, option *TorrentOption, meta map[string](int64)) error
DeleteTorrents(infoHashes []string, deleteFiles bool) error
PauseTorrents(infoHashes []string) error
ResumeTorrents(infoHashes []string) error
RecheckTorrents(infoHashes []string) error
ReannounceTorrents(infoHashes []string) error
AddTagsToTorrents(infoHashes []string, tags []string) error
RemoveTagsFromTorrents(infoHashes []string, tags []string) error
SetTorrentsSavePath(infoHashes []string, savePath string) error
PauseAllTorrents() error
ResumeAllTorrents() error
RecheckAllTorrents() error
ReannounceAllTorrents() error
AddTagsToAllTorrents(tags []string) error
RemoveTagsFromAllTorrents(tags []string) error
SetAllTorrentsSavePath(savePath string) error
GetTags() ([]string, error)
CreateTags(tags ...string) error
DeleteTags(tags ...string) error
// create category if not existed, edit category if already exists
MakeCategory(category string, savePath string) error
RemoveCategories(categories []string) error
GetCategories() ([]TorrentCategory, error)
SetTorrentsCatetory(infoHashes []string, category string) error
SetAllTorrentsCatetory(category string) error
TorrentRootPathExists(rootFolder string) bool
GetTorrentContents(infoHash string) ([]TorrentContentFile, error)
PurgeCache()
GetStatus() (*Status, error)
GetName() string
GetClientConfig() *config.ClientConfigStruct
SetConfig(variable string, value string) error
GetConfig(variable string) (string, error)
GetTorrentTrackers(infoHash string) (TorrentTrackers, error)
EditTorrentTracker(infoHash string, oldTracker string, newTracker string, replaceHost bool) error
AddTorrentTrackers(infoHash string, trackers []string, oldTracker string) error
RemoveTorrentTrackers(infoHash string, trackers []string) error
// QB only, priority: 0 Do not download; 1 Normal priority; 6 High priority; 7 Maximal priority
SetFilePriority(infoHash string, fileIndexes []int64, priority int64) error
Cached() bool
Close()
}
func CreateClient ¶
type ClientCreator ¶
type RegInfo ¶
type RegInfo struct {
Name string
Creator func(string, *config.ClientConfigStruct, *config.ConfigStruct) (Client, error)
}
type Status ¶
type Status struct {
FreeSpaceOnDisk int64 // -1 means unknown
UnfinishedSize int64
UnfinishedDownloadingSize int64
DownloadSpeed int64
UploadSpeed int64
DownloadSpeedLimit int64 // <= 0 means no limit
UploadSpeedLimit int64 // <= 0 means no limit
NoAdd bool // if true, brush and other tasks will NOT add any torrents to client
}
type Torrent ¶
type Torrent struct {
InfoHash string
Name string
TrackerDomain string
Tracker string
State string // simplified state: seeding|downloading|completed|paused|checking|error|unknown
LowLevelState string // original state value returned by bt client
Atime int64 // timestamp torrent added
Ctime int64 // timestamp torrent completed. <=0 if not completed.
Category string
SavePath string
ContentPath string
Tags []string
Downloaded int64
DownloadSpeed int64
DownloadSpeedLimit int64 // -1 means no limit
Uploaded int64
UploadSpeed int64
UploadedSpeedLimit int64 // -1 means no limit
Size int64 // size of torrent files that selected for downloading
SizeTotal int64 // Total size of all file in the torrent (including unselected ones)
SizeCompleted int64
Seeders int64
Leechers int64
Meta map[string](int64)
}
func QueryTorrents ¶ added in v0.1.1
func QueryTorrents(clientInstance Client, category string, tag string, filter string, hashOrStateFilters ...string) ([]Torrent, error)
parse and return torrents that meet criterion tag: comma-separated list, a torrent will match if it has any tag that in the list
func (*Torrent) GetCategoryFromTag ¶ added in v0.1.2
func (*Torrent) GetMetaFromTag ¶ added in v0.1.2
func (*Torrent) GetMetadataFromTags ¶ added in v0.1.5
func (*Torrent) GetSiteFromTag ¶
func (*Torrent) IsComplete ¶
func (*Torrent) IsFullComplete ¶
func (*Torrent) MatchStateFilter ¶ added in v0.1.1
func (*Torrent) RemoveSubstituteTags ¶ added in v0.1.5
func (torrent *Torrent) RemoveSubstituteTags()
func (*Torrent) StateIconText ¶ added in v0.1.5
type TorrentCategory ¶ added in v0.1.5
type TorrentContentFile ¶
type TorrentOption ¶
type TorrentTracker ¶ added in v0.1.1
type TorrentTrackers ¶ added in v0.1.5
type TorrentTrackers []TorrentTracker
func (TorrentTrackers) FindIndex ¶ added in v0.1.5
func (trackers TorrentTrackers) FindIndex(hostOrUrl string) int
return index or -1
Click to show internal directories.
Click to hide internal directories.