Documentation
¶
Overview ¶
Package jobs implements the transmissionrpc-powered job running system.
Index ¶
- func ConnectToRemote(settings TransmissionSettings) (*transmissionrpc.Client, error)
- func FetchSonarrDrops(settings SonarrSettings, maxRecords int) (paths map[string]bool, err error)
- type Config
- type FeedMatchOptions
- type FeedOptions
- type JobConfig
- type RemoveOptions
- type Runner
- type SonarrSettings
- type StoredTorrentInfo
- type TagOptions
- type TransmissionSettings
- type TransmissionTorrent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToRemote ¶
func ConnectToRemote(settings TransmissionSettings) (*transmissionrpc.Client, error)
ConnectToRemote creates an *transmissionrpc.Client.
func FetchSonarrDrops ¶
func FetchSonarrDrops(settings SonarrSettings, maxRecords int) (paths map[string]bool, err error)
FetchSonarrDrops crawls Sonarr's history for filesystem drop paths, going back up to maxRecords items. If maxRecords <= 0, this exhausts all possbile history items.
Types ¶
type Config ¶
type Config struct { DatabasePath string `mapstructure:"database"` Transmission TransmissionSettings Sonarr *SonarrSettings Jobs []JobConfig }
Config describes the schema of the .yml config file
type FeedMatchOptions ¶
type FeedMatchOptions struct { Field string RegExp string // contains filtered or unexported fields }
FeedMatchOptions describes a regular expression to run on a particular feed field.
type FeedOptions ¶
type FeedOptions struct { URL string Tag string // optional Match *FeedMatchOptions // optional }
FeedOptions describes how to add a torrent from an Atom/RSS feed.
func (*FeedOptions) Validate ¶
func (f *FeedOptions) Validate() error
Validate returns whether this is a legit thing we can do or not (and caches some stuff)
type JobConfig ¶
type JobConfig struct { Name string Location string SeedRatio float64 `mapstructure:"seed_ratio"` RemoveOptions *RemoveOptions `mapstructure:"remove"` TagOptions *TagOptions `mapstructure:"tag"` FeedOptions *FeedOptions `mapstructure:"feed"` }
JobConfig describes jobs to run. The presence of each 'SomethingOptions' field denotes the action.
type RemoveOptions ¶
RemoveOptions describes when and how to remove a torrent.
type Runner ¶
type Runner struct { Config Config DryRun bool Verbose bool // contains filtered or unexported fields }
Runner is what actually runs all of the jobs
type SonarrSettings ¶
SonarrSettings describes how to connect to a Sonarr server.
type StoredTorrentInfo ¶
type StoredTorrentInfo struct { ID int64 `boltholdKey:"ID"` FeedGUID string `boltholdIndex:"FeedGUID"` Removed bool Tags []string }
StoredTorrentInfo contains TransmissionTorrent info saved with bolthold. Usually embedded inside of TransmissionTorrent.
func (StoredTorrentInfo) SafeToPrune ¶
func (s StoredTorrentInfo) SafeToPrune() bool
SafeToPrune returns whether a piece of stored torrent state is worth keeping around.
type TagOptions ¶
TagOptions describes when and how to tag a torrent.
type TransmissionSettings ¶
TransmissionSettings describes how to connect to a Transmission RPC server.
type TransmissionTorrent ¶
type TransmissionTorrent struct { ActivityDate time.Time AddedDate time.Time BandwidthPriority int64 Comment string CorruptEver int64 Creator string DateCreated time.Time DesiredAvailable int64 DoneDate time.Time DownloadDir string DownloadedEver int64 DownloadLimit int64 DownloadLimited bool Error int64 ErrorString string Eta int64 EtaIdle int64 Files []*transmissionrpc.TorrentFile FileStats []*transmissionrpc.TorrentFileStat HashString string HaveUnchecked int64 HaveValid int64 HonorsSessionLimits bool ID int64 IsFinished bool IsPrivate bool IsStalled bool LeftUntilDone int64 MagnetLink string ManualAnnounceTime int64 MaxConnectedPeers int64 MetadataPercentComplete float64 Name string PeerLimit int64 Peers []*transmissionrpc.Peer PeersConnected int64 PeersFrom transmissionrpc.TorrentPeersFrom PeersGettingFromUs int64 PeersSendingToUs int64 PercentDone float64 Pieces string PieceCount int64 PieceSize cunits.Bits Priorities []int64 QueuePosition int64 RateDownload int64 RateUpload int64 RecheckProgress float64 SecondsDownloading int64 SecondsSeeding time.Duration SeedIdleLimit int64 SeedIdleMode int64 SeedRatioLimit float64 SeedRatioMode transmissionrpc.SeedRatioMode SizeWhenDone cunits.Bits StartDate time.Time Status transmissionrpc.TorrentStatus Trackers []*transmissionrpc.Tracker TrackerStats []*transmissionrpc.TrackerStats TotalSize cunits.Bits TorrentFile string UploadedEver int64 UploadLimit int64 UploadLimited bool UploadRatio float64 Wanted []bool WebSeeds []string WebSeedsSendingToUs int64 *StoredTorrentInfo // contains filtered or unexported fields }
TransmissionTorrent is a generated, pointer-free, and less safe variant of transmissionrpc.Torrent to make using the expr package easier.
func ToTransmissionTorrent ¶
func ToTransmissionTorrent(input transmissionrpc.Torrent, sonarrDropPaths map[string]bool) TransmissionTorrent
ToTransmissionTorrent converts the library struct to our generated struct.
func (TransmissionTorrent) AnnounceHostnames ¶
func (t TransmissionTorrent) AnnounceHostnames() (hostnames []string)
AnnounceHostnames returns a list of tracker announce URL hostnames.
func (*TransmissionTorrent) GetOrCreateStored ¶
func (t *TransmissionTorrent) GetOrCreateStored() *StoredTorrentInfo
GetOrCreateStored gets or creates StoredTorrent info.
func (TransmissionTorrent) Imported ¶
func (t TransmissionTorrent) Imported() bool
Imported returns whether all downloaded files were imported