Module: Leecher

Defined in:
lib/leecher.rb,
lib/leecher/client.rb,
lib/leecher/status.rb,
lib/leecher/version.rb,
lib/leecher/aria2/client.rb,
lib/leecher/gheed/client.rb,
lib/leecher/metalink_queue.rb

Defined Under Namespace

Modules: Aria2, Gheed Classes: Client, MetalinkQueue, Status

Constant Summary collapse

VERSION =
"1.1.1"

Class Method Summary collapse

Class Method Details

.aria2_clientObject



32
33
34
# File 'lib/leecher.rb', line 32

def aria2_client
  Leecher::Aria2::Client.new(config("aria2"))
end

.client_configObject



24
25
26
# File 'lib/leecher.rb', line 24

def client_config
  config("leecher")
end

.config(config) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/leecher.rb', line 9

def config(config)
  config = config.to_s
  config += ".yml" unless config =~ /\.yml$/

  # Development/git mode
  path = File.join(DAEMON_ROOT, "config", config)

  # Gem mode
  unless File.exist?(path)
    path = File.join(ENV["HOME"], ".leecher", config)
  end
  
  DaemonKit::Config.new(YAML.load_file(path))
end

.gheed_clientObject



28
29
30
# File 'lib/leecher.rb', line 28

def gheed_client
  Leecher::Gheed::Client.new(config("gheed"))
end

.newObject



36
37
38
# File 'lib/leecher.rb', line 36

def new
  Client.new(client_config, aria2_client, gheed_client)
end