Documentation ¶
Index ¶
- Constants
- type Field
- type FieldValue
- type File
- type RTorrent
- func (r *RTorrent) Add(url string, extraArgs ...*FieldValue) error
- func (r *RTorrent) AddStopped(url string, extraArgs ...*FieldValue) error
- func (r *RTorrent) AddTorrent(data []byte, extraArgs ...*FieldValue) error
- func (r *RTorrent) AddTorrentStopped(data []byte, extraArgs ...*FieldValue) error
- func (r *RTorrent) CloseTorrent(t Torrent) error
- func (r *RTorrent) Delete(t Torrent) error
- func (r *RTorrent) DownRate() (int, error)
- func (r *RTorrent) DownTotal() (int, error)
- func (r *RTorrent) GetFiles(t Torrent) ([]File, error)
- func (r *RTorrent) GetStatus(t Torrent) (Status, error)
- func (r *RTorrent) GetTorrent(hash string) (Torrent, error)
- func (r *RTorrent) GetTorrents(view View) ([]Torrent, error)
- func (r *RTorrent) IP() (string, error)
- func (r *RTorrent) IsActive(t Torrent) (bool, error)
- func (r *RTorrent) IsOpen(t Torrent) (bool, error)
- func (r *RTorrent) Name() (string, error)
- func (r *RTorrent) OpenTorrent(t Torrent) error
- func (r *RTorrent) PauseTorrent(t Torrent) error
- func (r *RTorrent) ResumeTorrent(t Torrent) error
- func (r *RTorrent) SetLabel(t Torrent, newLabel string) error
- func (r *RTorrent) StartTorrent(t Torrent) error
- func (r *RTorrent) State(t Torrent) (int, error)
- func (r *RTorrent) StopTorrent(t Torrent) error
- func (r *RTorrent) UpRate() (int, error)
- func (r *RTorrent) UpTotal() (int, error)
- func (r *RTorrent) WithHTTPClient(client *http.Client) *RTorrent
- type Status
- type Torrent
- type View
Constants ¶
const ( // ViewMain represents the "main" view, containing all torrents ViewMain View = "main" // ViewStarted represents the "started" view, containing only torrents that have been started ViewStarted View = "started" // ViewStopped represents the "stopped" view, containing only torrents that have been stopped ViewStopped View = "stopped" // ViewHashing represents the "hashing" view, containing only torrents that are currently hashing ViewHashing View = "hashing" // ViewSeeding represents the "seeding" view, containing only torrents that are currently seeding ViewSeeding View = "seeding" // DName represents the name of a "Downloading Items" DName Field = "d.name" // DLabel represents the label of a "Downloading Item" DLabel Field = "d.custom1" // DSizeInBytes represents the size in bytes of a "Downloading Item" DSizeInBytes Field = "d.size_bytes" // DHash represents the hash of a "Downloading Item" DHash Field = "d.hash" // DBasePath represents the base path of a "Downloading Item" DBasePath Field = "d.base_path" // DDirectory represents the directory of a "Downloading Item" DDirectory Field = "d.directory" // DIsActive represents whether a "Downloading Item" is active or not DIsActive Field = "d.is_active" // DRatio represents the ratio of a "Downloading Item" DRatio Field = "d.ratio" // DComplete represents whether the "Downloading Item" is complete or not DComplete Field = "d.complete" // DCompletedBytes represents the total of completed bytes of the "Downloading Item" DCompletedBytes Field = "d.completed_bytes" // DDownRate represents the download rate of the "Downloading Item" DDownRate Field = "d.down.rate" // DUpRate represents the upload rate of the "Downloading Item" DUpRate Field = "d.up.rate" // DCreationTime represents the date the torrent was created DCreationTime Field = "d.creation_date" // DFinishedTime represents the date the torrent finished downloading DFinishedTime Field = "d.timestamp.finished" // DStartedTime represents the date the torrent started downloading DStartedTime Field = "d.timestamp.started" // FPath represents the path of a "File Item" FPath Field = "f.path" // FSizeInBytes represents the size in bytes of a "File Item" FSizeInBytes Field = "f.size_bytes" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶ added in v1.5.0
type Field string
Field represents a attribute on a RTorrent entity that can be queried or set
func (Field) Cmd ¶ added in v1.5.0
Cmd returns the representation of the field which allows it to be used a command with RTorrent
func (Field) Query ¶ added in v1.5.0
Query converts the field to a string which allows it to be queried Example:
DName.Query() // returns "d.name="
func (Field) SetValue ¶ added in v1.5.0
func (f Field) SetValue(value string) *FieldValue
SetValue returns a FieldValue struct which can be used to set the field on a particular item in rTorrent to the specified value
type FieldValue ¶ added in v1.5.0
FieldValue contains the Field and Value of an attribute on a rTorrent
func (*FieldValue) String ¶ added in v1.5.0
func (f *FieldValue) String() string
type RTorrent ¶
type RTorrent struct {
// contains filtered or unexported fields
}
RTorrent is used to communicate with a remote rTorrent instance
func New ¶
New returns a new instance of `RTorrent` Pass in a true value for `insecure` to turn off certificate verification
func (*RTorrent) Add ¶ added in v0.4.0
func (r *RTorrent) Add(url string, extraArgs ...*FieldValue) error
Add adds a new torrent by URL and starts the torrent
extraArgs can be any valid rTorrent rpc command. For instance:
Adds the Torrent by URL and sets the label on the torrent
Add("some-url", "d.custom1.set=\"my-label\"")
Or:
Add("some-url", DLabel.SetValue("my-label"))
Adds the Torrent by URL and sets the label as well as base path
Add("some-url", "d.custom1.set=\"my-label\"", "d.base_path=\"/some/valid/path\"")
Or:
Add("some-url", DLabel.SetValue("my-label"), DBasePath.SetValue("/some/valid/path"))
func (*RTorrent) AddStopped ¶ added in v1.4.0
func (r *RTorrent) AddStopped(url string, extraArgs ...*FieldValue) error
AddStopped adds a new torrent by URL in a stopped state
extraArgs can be any valid rTorrent rpc command. For instance:
Adds the Torrent by URL (stopped) and sets the label on the torrent
AddStopped("some-url", &FieldValue{"d.custom1", "my-label"})
Or:
AddStopped("some-url", DLabel.SetValue("my-label"))
Adds the Torrent by URL (stopped) and sets the label and base path
AddStopped("some-url", &FieldValue{"d.custom1", "my-label"}, &FiedValue{"d.base_path", "/some/valid/path"})
Or:
AddStopped("some-url", DLabel.SetValue("my-label"), DBasePath.SetValue("/some/valid/path"))
func (*RTorrent) AddTorrent ¶ added in v0.4.0
func (r *RTorrent) AddTorrent(data []byte, extraArgs ...*FieldValue) error
AddTorrent adds a new torrent by the torrent files data and starts the torrent
extraArgs can be any valid rTorrent rpc command. For instance:
Adds the Torrent file and sets the label on the torrent
Add(fileData, "d.custom1.set=\"my-label\"")
Or:
AddTorrent(fileData, DLabel.SetValue("my-label"))
Adds the Torrent file and sets the label and base path
Add(fileData, "d.custom1.set=\"my-label\"", "d.base_path=\"/some/valid/path\"")
Or:
AddTorrent(fileData, DLabel.SetValue("my-label"), DBasePath.SetValue("/some/valid/path"))
func (*RTorrent) AddTorrentStopped ¶ added in v1.4.0
func (r *RTorrent) AddTorrentStopped(data []byte, extraArgs ...*FieldValue) error
AddTorrentStopped adds a new torrent by the torrent files data but does not start the torrent
extraArgs can be any valid rTorrent rpc command. For instance:
Adds the Torrent file (stopped) and sets the label on the torrent
AddTorrentStopped(fileData, "d.custom1.set=\"my-label\"")
Or:
AddTorrentStopped(fileData, DLabel.SetValue("my-label"))
Adds the Torrent file and (stopped) sets the label and base path
AddTorrentStopped(fileData, "d.custom1.set=\"my-label\"", "d.base_path=\"/some/valid/path\"")
Or:
AddTorrentStopped(fileData, DLabel.SetValue("my-label"), DBasePath.SetValue("/some/valid/path"))
func (*RTorrent) CloseTorrent ¶ added in v1.8.0
CloseTorrent closes the torrent
func (*RTorrent) DownRate ¶ added in v1.1.0
DownRate returns the current download rate reported by this RTorrent instance (bytes/s)
func (*RTorrent) DownTotal ¶
DownTotal returns the total downloaded metric reported by this RTorrent instance (bytes)
func (*RTorrent) GetTorrent ¶ added in v1.3.0
GetTorrent returns the torrent identified by the given hash
func (*RTorrent) GetTorrents ¶
GetTorrents returns all of the torrents reported by this RTorrent instance
func (*RTorrent) OpenTorrent ¶ added in v1.8.0
OpenTorrent opens the torrent
func (*RTorrent) PauseTorrent ¶ added in v1.8.0
PauseTorrent pauses the torrent
func (*RTorrent) ResumeTorrent ¶ added in v1.8.0
ResumeTorrent resumes the torrent
func (*RTorrent) StartTorrent ¶ added in v1.8.0
StartTorrent starts the torrent
func (*RTorrent) State ¶ added in v1.8.0
State returns the state that the torrent is into It returns: 0 for stopped, 1 for started/paused
func (*RTorrent) StopTorrent ¶ added in v1.8.0
StopTorrent stops the torrent
func (*RTorrent) UpRate ¶ added in v1.1.0
UpRate returns the current upload rate reported by this RTorrent instance (bytes/s)
type Status ¶ added in v1.1.0
type Status struct { Completed bool CompletedBytes int DownRate int UpRate int Ratio float64 Size int }
Status represents the status of a torrent