Module: Quiyo::Server

Included in:
Quiyo
Defined in:
lib/quiyo/server.rb

Instance Method Summary collapse

Instance Method Details

#list(type, arg = nil) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/quiyo/server.rb', line 33

def list(type, arg = nil)
  case type
  when "artists"
    @mpd.artists.each { |s| p s }
  when "albums"
    @mpd.albums(arg.drop(1).join(" ")).each { |s| p s }
  end
end

#quitObject



12
13
14
15
# File 'lib/quiyo/server.rb', line 12

def quit
  @mpd.disconnect
  Process.exit
end

#search(action) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/quiyo/server.rb', line 23

def search(action)
  @mpd.search(action[1], action.drop(2).join(" ")).each { |s|
    printf "%s : %s [%s]\n" % [
                               colorize(s.artist, 99),
                               colorize(s.title, 202),
                               colorize(s.album, 107)
                              ]
  }
end

#vol(arg) ⇒ Object



17
18
19
20
21
# File 'lib/quiyo/server.rb', line 17

def vol(arg)
  @mpd.volume=(arg)
rescue
  p "Usage: vol [0-100]"
end