Module: Server

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

Instance Method Summary collapse

Instance Method Details

#list(type, arg = nil) ⇒ Object



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

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



2
3
4
5
# File 'lib/quiyo/server.rb', line 2

def quit
  @mpd.disconnect
  Process.exit
end

#search(action) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/quiyo/server.rb', line 13

def search(action)
  @mpd.search(action[1], action.drop(2).join(" ")).each { |s|
    printf "%s : %s [%s]\n" % [
      yellow(s.artist),
      blue(s.title),
      green(s.album)
    ]
  }
rescue
  p "Usage: search [artist|title|album] name"
end

#vol(arg) ⇒ Object



7
8
9
10
11
# File 'lib/quiyo/server.rb', line 7

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