Class: Walkman::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/walkman/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/walkman/config.rb', line 30

def initialize
  # global
  @log_level   = "debug"

  # server
  @server_host = "localhost"
  @server_port = 27001
  @drb_uri     = "druby://#{@server_host}:#{@server_port}"

  # echo nest
  @echonest_api_key       = nil
  @echonest_consumer_key  = nil
  @echonest_shared_secret = nil
  @echonest_catalog_id    = nil

  # rdio service
  @rdio_player_url        = "http://localhost:4567/rdio"
  @rdio_playback_token    = nil
  @rdio_browser_path      = '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --no-process-singleton-dialog' # must be single quotes
end

Instance Attribute Details

#drb_uriObject (readonly)

Returns the value of attribute drb_uri.



17
18
19
# File 'lib/walkman/config.rb', line 17

def drb_uri
  @drb_uri
end

#echonest_api_keyObject (readonly)

echonest



20
21
22
# File 'lib/walkman/config.rb', line 20

def echonest_api_key
  @echonest_api_key
end

#echonest_catalog_idObject (readonly)

Returns the value of attribute echonest_catalog_id.



23
24
25
# File 'lib/walkman/config.rb', line 23

def echonest_catalog_id
  @echonest_catalog_id
end

#echonest_consumer_keyObject (readonly)

Returns the value of attribute echonest_consumer_key.



21
22
23
# File 'lib/walkman/config.rb', line 21

def echonest_consumer_key
  @echonest_consumer_key
end

#echonest_shared_secretObject (readonly)

Returns the value of attribute echonest_shared_secret.



22
23
24
# File 'lib/walkman/config.rb', line 22

def echonest_shared_secret
  @echonest_shared_secret
end

#log_levelObject

logger



12
13
14
# File 'lib/walkman/config.rb', line 12

def log_level
  @log_level
end

#rdio_browser_pathObject (readonly)

Returns the value of attribute rdio_browser_path.



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

def rdio_browser_path
  @rdio_browser_path
end

#rdio_playback_tokenObject (readonly)

Returns the value of attribute rdio_playback_token.



27
28
29
# File 'lib/walkman/config.rb', line 27

def rdio_playback_token
  @rdio_playback_token
end

#rdio_player_urlObject (readonly)

rdio



26
27
28
# File 'lib/walkman/config.rb', line 26

def rdio_player_url
  @rdio_player_url
end

#server_hostObject (readonly)

cli/drb



15
16
17
# File 'lib/walkman/config.rb', line 15

def server_host
  @server_host
end

#server_portObject (readonly)

Returns the value of attribute server_port.



16
17
18
# File 'lib/walkman/config.rb', line 16

def server_port
  @server_port
end

Instance Method Details

#load_file(config_file) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/walkman/config.rb', line 51

def load_file(config_file)
  file = File.expand_path(config_file)

  if File.file?(file)
    configs = YAML.load(File.read(file))
    load_global_configs(configs)
    load_server_configs(configs["server"])
    load_echonest_configs(configs["echonest"])
    load_rdio_configs(configs["rdio"])
  end
end