Module: Quiyo::Playlist

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

Instance Method Summary collapse

Instance Method Details

#addtoplist(action) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/quiyo/playlist.rb', line 11

def addtoplist(action)
	@mpd.search(action[1], action.drop(2).join(" ")).each { |s|
		@mpd.add(s.file)
	}
rescue
	puts "Usage: addtoplaylist searchstring"
end

#clearplistObject



7
8
9
# File 'lib/quiyo/playlist.rb', line 7

def clearplist
	@mpd.clear
end

#lsplistObject



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

def lsplist
	@mpd.playlist.each { |s| printsonglist(s) }
end

#randomalbum(opt) ⇒ Object



27
28
29
30
# File 'lib/quiyo/playlist.rb', line 27

def randomalbum(opt)
	@mpd.clear if opt == "clear"
	addtoplist("album", @mpd.albums[rand(@mpd.albums.length)])
end

#removefromplist(id) ⇒ Object



19
20
21
# File 'lib/quiyo/playlist.rb', line 19

def removefromplist(id)
	@mpd.delete(id)
end

#saveplist(name) ⇒ Object



23
24
25
# File 'lib/quiyo/playlist.rb', line 23

def saveplist(name)
	@mpd.save(name)
end