transmission

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	URL        string
}

Client calls the Transmission APIs

func NewClient

func NewClient(url string, roundTripper http.RoundTripper) *Client

func (*Client) GetSessionParameters

func (c *Client) GetSessionParameters(ctx context.Context) (SessionParameters, error)

GetSessionParameters calls Transmission's "session-get" method. It returns the Transmission instance's configuration parameters

func (*Client) GetSessionStatistics

func (c *Client) GetSessionStatistics(ctx context.Context) (SessionStats, error)

GetSessionStatistics calls Transmission's "session-stats" method. It returns the Transmission instance's session statistics

type SessionParameters

type SessionParameters struct {
	Arguments struct {
		AltSpeedDown              int     `json:"alt-speed-down"`
		AltSpeedEnabled           bool    `json:"alt-speed-enabled"`
		AltSpeedTimeBegin         int     `json:"alt-speed-time-begin"`
		AltSpeedTimeDay           int     `json:"alt-speed-time-day"`
		AltSpeedTimeEnabled       bool    `json:"alt-speed-time-enabled"`
		AltSpeedTimeEnd           int     `json:"alt-speed-time-end"`
		AltSpeedUp                int     `json:"alt-speed-up"`
		BlocklistEnabled          bool    `json:"blocklist-enabled"`
		BlocklistSize             int     `json:"blocklist-size"`
		BlocklistURL              string  `json:"blocklist-url"`
		CacheSizeMb               int     `json:"cache-size-mb"`
		ConfigDir                 string  `json:"config-dir"`
		DhtEnabled                bool    `json:"dht-enabled"`
		DownloadDir               string  `json:"download-dir"`
		DownloadDirFreeSpace      int64   `json:"download-dir-free-space"`
		DownloadQueueEnabled      bool    `json:"download-queue-enabled"`
		DownloadQueueSize         int     `json:"download-queue-size"`
		Encryption                string  `json:"encryption"`
		IdleSeedingLimit          int     `json:"idle-seeding-limit"`
		IdleSeedingLimitEnabled   bool    `json:"idle-seeding-limit-enabled"`
		IncompleteDir             string  `json:"incomplete-dir"`
		IncompleteDirEnabled      bool    `json:"incomplete-dir-enabled"`
		LpdEnabled                bool    `json:"lpd-enabled"`
		PeerLimitGlobal           int     `json:"peer-limit-global"`
		PeerLimitPerTorrent       int     `json:"peer-limit-per-torrent"`
		PeerPort                  int     `json:"peer-port"`
		PeerPortRandomOnStart     bool    `json:"peer-port-random-on-start"`
		PexEnabled                bool    `json:"pex-enabled"`
		PortForwardingEnabled     bool    `json:"port-forwarding-enabled"`
		QueueStalledEnabled       bool    `json:"queue-stalled-enabled"`
		QueueStalledMinutes       int     `json:"queue-stalled-minutes"`
		RenamePartialFiles        bool    `json:"rename-partial-files"`
		RPCVersion                int     `json:"rpc-version"`
		RPCVersionMinimum         int     `json:"rpc-version-minimum"`
		ScriptTorrentDoneEnabled  bool    `json:"script-torrent-done-enabled"`
		ScriptTorrentDoneFilename string  `json:"script-torrent-done-filename"`
		SeedQueueEnabled          bool    `json:"seed-queue-enabled"`
		SeedQueueSize             int     `json:"seed-queue-size"`
		SeedRatioLimit            float64 `json:"seedRatioLimit"`
		SeedRatioLimited          bool    `json:"seedRatioLimited"`
		SpeedLimitDown            int     `json:"speed-limit-down"`
		SpeedLimitDownEnabled     bool    `json:"speed-limit-down-enabled"`
		SpeedLimitUp              int     `json:"speed-limit-up"`
		SpeedLimitUpEnabled       bool    `json:"speed-limit-up-enabled"`
		StartAddedTorrents        bool    `json:"start-added-torrents"`
		TrashOriginalTorrentFiles bool    `json:"trash-original-torrent-files"`
		Units                     struct {
			MemoryBytes int      `json:"memory-bytes"`
			MemoryUnits []string `json:"memory-units"`
			SizeBytes   int      `json:"size-bytes"`
			SizeUnits   []string `json:"size-units"`
			SpeedBytes  int      `json:"speed-bytes"`
			SpeedUnits  []string `json:"speed-units"`
		} `json:"units"`
		UtpEnabled bool   `json:"utp-enabled"`
		Version    string `json:"version"`
	} `json:"arguments"`
	Result string `json:"result"`
}

SessionParameters contains the response to Transmission's "session-get" method. It contains all configuration parameters of the Transmission instance.

type SessionStats

type SessionStats struct {
	Arguments struct {
		ActiveTorrentCount int `json:"activeTorrentCount"`
		CumulativeStats    struct {
			DownloadedBytes int64 `json:"downloadedBytes"`
			FilesAdded      int   `json:"filesAdded"`
			SecondsActive   int   `json:"secondsActive"`
			SessionCount    int   `json:"sessionCount"`
			UploadedBytes   int64 `json:"uploadedBytes"`
		} `json:"cumulative-stats"`
		CurrentStats struct {
			DownloadedBytes int64 `json:"downloadedBytes"`
			FilesAdded      int   `json:"filesAdded"`
			SecondsActive   int   `json:"secondsActive"`
			SessionCount    int   `json:"sessionCount"`
			UploadedBytes   int   `json:"uploadedBytes"`
		} `json:"current-stats"`
		DownloadSpeed      int `json:"downloadSpeed"`
		PausedTorrentCount int `json:"pausedTorrentCount"`
		TorrentCount       int `json:"torrentCount"`
		UploadSpeed        int `json:"uploadSpeed"`
	} `json:"arguments"`
	Result string `json:"result"`
}

SessionStats contains the response to Transmission's "session-stats" method. It contains statistics of the Transmission instance.

Jump to

Keyboard shortcuts

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