Documentation
¶
Index ¶
- Constants
- type ApiClient
- type Command
- func NewAddCmd() (*Command, error)
- func NewAddCmdByFile(file string) (*Command, error)
- func NewAddCmdByFilename(filename string) (*Command, error)
- func NewAddCmdByMagnet(magnetLink string) (*Command, error)
- func NewAddCmdByURL(url string) (*Command, error)
- func NewDelCmd(id int, removeFile bool) (*Command, error)
- func NewGetTorrentsCmd() (*Command, error)
- func NewSetCmd(id int) (*Command, error)
- type File
- type Torrent
- type TorrentAdded
- type Torrents
- type TrackerStat
- type TransmissionClient
- func (ac *TransmissionClient) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
- func (ac *TransmissionClient) ExecuteCommand(cmd *Command) (*Command, error)
- func (ac *TransmissionClient) GetTorrent(id int) (Torrent, error)
- func (ac *TransmissionClient) GetTorrents() (Torrents, error)
- func (ac *TransmissionClient) StartTorrent(id int) (string, error)
- func (ac *TransmissionClient) StopTorrent(id int) (string, error)
- func (ac *TransmissionClient) VerifyTorrent(id int) (string, error)
Constants ¶
View Source
const ( StatusPaused = 0 StatusWait = 1 StatusCheck = 2 StatusDownloadWait = 3 StatusDownload = 4 StatisSeedWait = 5 StatusSeed = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
func (*ApiClient) CreateClient ¶
type Command ¶
type Command struct {
Method string `json:"method,omitempty"`
Arguments arguments `json:"arguments,omitempty"`
Result string `json:"result,omitempty"`
}
func NewAddCmdByFile ¶
func NewAddCmdByFilename ¶
func NewAddCmdByMagnet ¶
func NewAddCmdByURL ¶
func NewGetTorrentsCmd ¶
func (*Command) SetDownloadDir ¶
type Torrent ¶
type Torrent struct {
ID int `json:"id"`
Name string `json:"name"`
Status int `json:"status"`
AddedDate int `json:"addedDate"`
LeftUntilDone int64 `json:"leftUntilDone"`
Eta int `json:"eta"`
UploadRatio float64 `json:"uploadRatio"`
RateDownload int `json:"rateDownload"`
RateUpload int `json:"rateUpload"`
DownloadDir string `json:"downloadDir"`
IsFinished bool `json:"isFinished"`
PercentDone float64 `json:"percentDone"`
SeedRatioMode int `json:"seedRatioMode"`
HashString string `json:"hashString"`
Error int `json:"error"`
ErrorString string `json:"errorString"`
TrackerStats []TrackerStat `json:"trackerStats"`
Files []File `json:"files"`
}
Torrent struct for torrents
type TorrentAdded ¶
type TorrentAdded struct {
HashString string `json:"hashString"`
ID int `json:"id"`
Name string `json:"name"`
}
TorrentAdded data returning
type Torrents ¶
type Torrents []Torrent
Torrents represent []Torrent
func (Torrents) SortByAddedDate ¶
func (Torrents) SortByName ¶
type TrackerStat ¶
type TrackerStat struct {
Announce string `json:"announce"`
AnnounceState int `json:"announceState"`
DownloadCount int `json:"downloadCount"`
HasAnnounced bool `json:"hasAnnounced"`
HasScraped bool `json:"hasScraped"`
Host string `json:"host"`
ID uint64 `json:"id"`
IsBackup bool `json:"isBackup"`
LastAnnouncePeerCount int `json:"lastAnnouncePeerCount"`
LastAnnounceResult string `json:"lastAnnounceResult"`
LastAnnounceStartTime int64 `json:"lastAnnounceStartTime"`
LastAnnounceSucceeded bool `json:"lastAnnounceSucceeded"`
LastAnnounceTime int64 `json:"lastAnnounceTime"`
LastAnnounceTimedOut bool `json:"lastAnnounceTimedOut"`
LastScrapeResult string `json:"lastScrapeResult"`
LastScrapeStartTime int64 `json:"lastScrapeStartTime"`
LastScrapeSucceeded bool `json:"lastScrapeSucceeded"`
LastScrapeTime int64 `json:"lastScrapeTime"`
LastScrapeTimedOut bool `json:"lastScrapeTimedOut"`
LeecherCount int `json:"leecherCount"`
NextAnnounceTime int64 `json:"nextAnnounceTime"`
NextScrapeTime int64 `json:"nextScrapeTime"`
Scrape string `json:"scrape"`
ScrapeState int `json:"scrapeState"`
SeederCount int `json:"seederCount"`
Tier int `json:"tier"`
}
TrackerStat struct for tracker stats.
type TransmissionClient ¶
type TransmissionClient struct {
// contains filtered or unexported fields
}
TransmissionClient to talk to transmission
func New ¶
func New(url string, username string, password string) TransmissionClient
New create new transmission torrent
func (*TransmissionClient) ExecuteAddCommand ¶
func (ac *TransmissionClient) ExecuteAddCommand(addCmd *Command) (TorrentAdded, error)
func (*TransmissionClient) ExecuteCommand ¶
func (ac *TransmissionClient) ExecuteCommand(cmd *Command) (*Command, error)
func (*TransmissionClient) GetTorrent ¶
func (ac *TransmissionClient) GetTorrent(id int) (Torrent, error)
GetTorrent get a torrent by its ID
func (*TransmissionClient) GetTorrents ¶
func (ac *TransmissionClient) GetTorrents() (Torrents, error)
GetTorrents get a list of torrents
func (*TransmissionClient) StartTorrent ¶
func (ac *TransmissionClient) StartTorrent(id int) (string, error)
StartTorrent start the torrent
func (*TransmissionClient) StopTorrent ¶
func (ac *TransmissionClient) StopTorrent(id int) (string, error)
StopTorrent start the torrent
func (*TransmissionClient) VerifyTorrent ¶
func (ac *TransmissionClient) VerifyTorrent(id int) (string, error)
VerifyTorrent verify the torrent
Click to show internal directories.
Click to hide internal directories.