Skip to content

Commit

Permalink
md: The query function area actually not using regexps
Browse files Browse the repository at this point in the history
  • Loading branch information
jpablobr committed Feb 12, 2012
1 parent a5806dd commit 793fd73
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions playr
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,32 @@ module Playr
@mpd.current_song.each_pair { |k,v| @print.write(blue(k+": ") + v +"\n") }
end

def search rgx
@mpd.songs.select { |song| song.fetch('file')[rgx.to_s] }
def search what
@mpd.songs.select { |song| song.fetch('file')[what] }
.each { |sng| @print.search(sng) }
end

def songs rgx=nil
if rgx
list = @mpd.songs.select { |s| s.fetch('file')[rgx] }
def songs what=nil
if what
list = @mpd.songs.select { |s| s.fetch('file')[what] }
else
list = @mpd.songs
end
@print.songs(list)
end

def playlist rgx=nil
if rgx
songs = @mpd.playlist.select { |s| s.fetch('file')[rgx] }
def playlist what=nil
if what
songs = @mpd.playlist.select { |s| s.fetch('file')[what] }
else
songs = @mpd.playlist
end
@print.playlist(songs)
end

def playlists rgx=nil
if rgx
songs = @mpd.playlists.select { |pl| pl[rgx] }
def playlists what=nil
if what
songs = @mpd.playlists.select { |pl| pl[what] }
else
songs = @mpd.playlists
end
Expand Down

0 comments on commit 793fd73

Please sign in to comment.