Documentation ¶
Index ¶
- Constants
- Variables
- type ActionResult
- type Client
- func (ut *Client) AddFile(torrentFile *os.File) (*ActionResult, error)
- func (ut *Client) AddURL(torrenturl string) (*ActionResult, error)
- func (ut *Client) ForceStart(hash []string) error
- func (ut *Client) ListFiles() (*ListFileResponse, error)
- func (ut *Client) Pause(hash []string) error
- func (ut *Client) Recheck(hash []string) error
- func (ut *Client) Remove(hash []string) error
- func (ut *Client) RemoveData(hash []string) error
- func (ut *Client) SetLabel(hash, label string) error
- func (ut *Client) SetPriorityBottom(hash []string) error
- func (ut *Client) SetPriorityTop(hash []string) error
- func (ut *Client) Start(hash []string) error
- func (ut *Client) Stop(hash []string) error
- func (ut *Client) Unpause(hash []string) error
- type ClientError
- type Label
- type LabelFieldIndex
- type ListFileResponse
- type StatusMap
- type Torrent
- type TorrentCollection
- type TorrentFieldIndex
- type TorrentSortAsc
Constants ¶
View Source
const ( TorrentStatusStarted uint8 = 1 << 0 TorrentStatusChecking uint8 = 1 << 1 TorrentStatusStartAfterCheck uint8 = 1 << 2 TorrentStatusChecked uint8 = 1 << 3 TorrentStatusError uint8 = 1 << 4 TorrentStatusPaused uint8 = 1 << 5 TorrentStatusQueued uint8 = 1 << 6 TorrentStatusLoaded uint8 = 1 << 7 )
UTorrent file status
Status:
1 = Started 2 = Checking 4 = Start after check 8 = Checked 16 = Error 32 = Paused 64 = Queued 128 = Loaded
Variables ¶
View Source
var ByAdded = TorrentSortAsc(func(a, b *Torrent) bool {
return a.DateAdded < b.DateAdded
})
ByAdded sort []Torrent by Added Date
View Source
var ByFinished = TorrentSortAsc(func(a, b *Torrent) bool {
return a.DateCompleted < b.DateCompleted
})
ByFinished sort []Torrent by Finished Date
View Source
var ByName = TorrentSortAsc(func(a, b *Torrent) bool {
return a.Name < b.Name
})
ByName sort []Torrent by Name
View Source
var ByProgress = TorrentSortAsc(func(a, b *Torrent) bool {
return a.Progress < b.Progress
})
ByProgress sort []Torrent by progress
View Source
var ByQueueOrder = TorrentSortAsc(func(a, b *Torrent) bool {
return a.TorrentQueueOrder < b.TorrentQueueOrder
})
ByQueueOrder sort []Torrent by Queue Order #
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL string Username string Password string Token string Authorize string // contains filtered or unexported fields }
Client ...
func (*Client) AddFile ¶
func (ut *Client) AddFile(torrentFile *os.File) (*ActionResult, error)
AddFile ..
func (*Client) AddURL ¶
func (ut *Client) AddURL(torrenturl string) (*ActionResult, error)
AddURL ..
func (*Client) SetPriorityBottom ¶
SetPriorityBottom set priority to lowest.
func (*Client) SetPriorityTop ¶
SetPriorityTop set priority to highest.
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
ClientError ...
func (ClientError) Error ¶
func (ce ClientError) Error() string
type LabelFieldIndex ¶
type LabelFieldIndex int
LabelFieldIndex ...
const ( LabelIndexName LabelFieldIndex = iota // 0: Name LabelIndexCount // 1: Count )
type ListFileResponse ¶
type ListFileResponse struct { Build int `json:"build"` //Utorrent Client Build # Label []Label `json:"label"` //Labels Torrents []Torrent `json:"torrents"` //Torrents Torrentc string `json:"torrentc"` //Cache ID Rssfeeds []string `json:"rssfeeds"` Rssfilters []string `json:"rssfilters"` Messages []string `json:"messages"` }
ListFileResponse ...
type Torrent ¶
type Torrent struct { Hash string Status uint8 Name string Size uint64 Progress uint32 Downloaded uint64 Uploaded uint64 Ratio uint64 UlSpeed uint32 DlSpeed uint32 Eta uint32 Label string PeerConnected uint32 PeerInSwarm uint32 SeedConnected uint32 SeedInSwarm uint32 Availability uint32 TorrentQueueOrder uint32 Remaining uint32 DownloadURL string StatusMessage string DateAdded uint64 DateCompleted uint64 SavePath string }
Torrent ...
func (Torrent) AvailabilityRatio ¶
AvailabilityRatio Torrent.Availability devided by 65535
func (Torrent) PercentCompleted ¶
PercentCompleted Torrent.Progress devided by 10..
type TorrentCollection ¶
type TorrentCollection []Torrent
TorrentCollection slice of Torrent
func (TorrentCollection) Sort ¶
func (t TorrentCollection) Sort(by TorrentSortAsc, desc bool)
Sort sort []Torrent by Name
type TorrentFieldIndex ¶
type TorrentFieldIndex int
TorrentFieldIndex ...
const ( TorrentsIndexHash TorrentFieldIndex = iota // 0: Hash (string), TorrentsIndexStatus // 1: Status* (integer), TorrentsIndexName // 2: Name (string), TorrentsIndexSize // 3: Size (integer in bytes), TorrentsIndexProgress // 4: Percent Progress (integer in per mils), TorrentsIndexDownloaded // 5: Downloaded (integer in bytes), TorrentsIndexUploaded // 6: Uploaded (integer in bytes), TorrentsIndexRatio // 7: Ratio (integer in per mils), TorrentsIndexUploadSpeed // 8: Upload Speed (integer in bytes per second), TorrentsIndexDownloadSpeed // 9: Download Speed (integer in bytes per second), TorrentsIndexETA // 10: ETA (integer in seconds), TorrentsIndexLabel // 11: Label (string), TorrentsIndexPeerConnected // 12: Peers Connected (integer), TorrentsIndexPeersInSwarm // 13: Peers In Swarm (integer), TorrentsIndexSeedsConnected // 14: Seeds Connected (integer), TorrentsIndexSeedsInSwarm // 15: Seeds In Swarm (integer), TorrentsIndexAvailability // 16: Availability (integer in 1/65535ths), TorrentsIndexQueueOrder // 17: Torrent Queue Order (integer), TorrentsIndexRemaining // 18: Remaining (integer in bytes) TorrentsIndexDownloadURL // 19: Download URL TorrentsIndexRssFeedURL // 20: Rss Feed URL TorrentsIndexStatusMessage // 21: Status Message TorrentsIndexStreamID // 22: Stream ID TorrentsIndexDateAdded // 23: Remaining (integer in bytes) TorrentsIndexDateCompleted // 24: Remaining (integer in bytes) TorrentsIndexAppUpdateURL // 25: App Update URL TorrentsIndexSavePath // 26: Remaining (integer in bytes) )
Defined torrents index of each `json: "torrents"` field
Click to show internal directories.
Click to hide internal directories.