|
@@ -3,15 +3,6 @@
|
|
|
module RSeed
|
|
|
class Server < Sinatra::Base
|
|
|
|
|
|
- # ConstrucThor huhu
|
|
|
- # -----------------
|
|
|
- def initialize(*args, &blk)
|
|
|
- super
|
|
|
- RSeed::Config.instance_eval(&blk) if block_given?
|
|
|
- @config = Config
|
|
|
- @rtorrent = Rtorrent.new(@config.get(:rpc_host), @config.get(:rpc_path), @config.get(:rpc_port))
|
|
|
- end
|
|
|
-
|
|
|
# Sinatra Conf
|
|
|
# ------------
|
|
|
set :root, File.join(File.dirname(__FILE__), '..', '..')
|
|
@@ -22,6 +13,21 @@ module RSeed
|
|
|
cache_control :public, :must_revalidate, :max_age => 60
|
|
|
end
|
|
|
|
|
|
+ # ConstrucThor huhu
|
|
|
+ # -----------------
|
|
|
+ def initialize(*args, &blk)
|
|
|
+ super
|
|
|
+ RSeed::Config.instance_eval(&blk) if block_given?
|
|
|
+ @config = Config
|
|
|
+ confFile = File.join(settings.root, 'config.yml')
|
|
|
+ if File.exists? confFile
|
|
|
+ YAML.load_file(confFile).each_value do |c|
|
|
|
+ c.each {|key, value| @config.set(key,value)}
|
|
|
+ end
|
|
|
+ end
|
|
|
+ @rtorrent = Rtorrent.new(@config.get("rpc_host"), @config.get("rpc_path"), @config.get("rpc_port"))
|
|
|
+ end
|
|
|
+
|
|
|
# Helperz
|
|
|
# -------
|
|
|
helpers do
|