Module: Astrobot
- Defined in:
- lib/astrobot.rb,
lib/astrobot/client.rb,
lib/astrobot/logger.rb,
lib/astrobot/torrent.rb,
lib/astrobot/version.rb,
lib/astrobot/controls.rb
Defined Under Namespace
Classes: Client, Controls, Logger, Torrent, Version
Constant Summary collapse
- TORRENT_FIELDS =
[ "id", "name", 'status', "totalSize", "addedDate", "isFinished", "rateDownload", "rateUpload", "percentDone", "files", "hashString" ]
- TORRENT_ALL_FIELDS =
[ 'addedDate', 'bandwidthPriority', 'comment', 'corruptEver', 'creator', 'dateCreated', 'desiredAvailable', 'doneDate', 'downloadDir', 'downloadedEver', 'downloadLimit', 'downloadLimited', 'error', 'errorString', 'eta', 'etaIdle', 'files', 'fileStats', 'hashString', 'haveUnchecked', 'haveValid', 'honorsSessionLimits', 'id', 'isFinished', 'isPrivate', 'isStalled', 'leftUntilDone', 'magnetLink', 'manualAnnounceTime', 'maxConnectedPeers', 'metadataPercentComplete', 'name', 'peer-limit', 'peers', 'peersConnected', 'peersFrom', 'peersGettingFromUs', 'peersSendingToUs', 'percentDone', 'pieces', 'pieceCount', 'pieceSize', 'priorities', 'queuePosition', 'rateDownload(B/s)', 'rateUpload(B/s)', 'recheckProgress', 'secondsDownloading', 'secondsSeeding', 'seedIdleLimit', 'seedIdleMode', 'seedRatioLimit', 'seedRatioMode', 'sizeWhenDone', 'startDate', 'status', 'trackers', 'trackerStats', 'totalSize', 'torrentFile', 'uploadedEver', 'uploadLimit', 'uploadLimited', 'uploadRatio', 'wanted', 'webseeds', 'webseedsSendingToUs' ]
- YAML_INITIALIZER_PATH =
File.dirname(__FILE__)
- @@config =
Configuration defaults
{ url: 'http://127.0.0.1:9091/transmission/rpc', fields: TORRENT_ALL_FIELDS, basic_auth: { :username => '', :password => '' }, session_id: "NOT-INITIALIZED", debug_mode: false }
Class Method Summary collapse
-
.config ⇒ Object
Access to config variables.
-
.configure(opts = {}) ⇒ Object
Configure through hash.
-
.configure_with(yaml_file_path = nil) ⇒ Object
Configure through yaml file for ruby scripting usage.
Class Method Details
.config ⇒ Object
Access to config variables
130 131 132 133 |
# File 'lib/astrobot.rb', line 130 def self.config @@config = configure unless @@config @@config end |
.configure(opts = {}) ⇒ Object
Configure through hash
110 111 112 |
# File 'lib/astrobot.rb', line 110 def self.configure(opts = {}) opts.each {|k,v| @@config[k.to_sym] = v if @valid_config_keys.include? k.to_sym} end |
.configure_with(yaml_file_path = nil) ⇒ Object
Configure through yaml file for ruby scripting usage
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/astrobot.rb', line 116 def self.configure_with(yaml_file_path = nil) yaml_file_path = YAML_INITIALIZER_PATH unless yaml_file_path begin config = YAML::load(IO.read(path_to_yaml_file)) rescue Errno::ENOENT Logger.add(:warning, "YAML configuration file couldn't be found. Using defaults."); return rescue Psych::SyntaxError Logger.add(:warning, "YAML configuration file contains invalid syntax. Using defaults."); return end configure(config) end |