Sha256: 98a64b2144890ab4060db8cf60d42fb1eabedcee7f60909deea175af9b5059f7
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
require 'bundler' Bundler.setup :default require 'logger' require 'mpd_client' # MPDClient.log = Logger.new($stderr) client = MPDClient.new type = ARGV[0] what = ARGV[1] client = MPDClient.new client.log = Logger.new($stderr) # Connecting to the server client.connect('localhost', 6600) puts "MPD version: #{client.mpd_version}" puts "mpd_client version: #{MPDClient::VERSION}" client.stop client.clear # clear the current playlist # Finds songs in the db that are exactly `what`. # `type` can be any tag supported by MPD # or one of the two special parameters: # * 'file' - to search by full path (relative to database root), # * 'any' - to match against all available tags. songs = client.search(type, what) client.command_list_ok_begin # start a command list to speed up operations songs.each do |song| client.add(song['file']) if song.has_key?('file') end client.command_list_end client.play client.close client.disconnect # disconnect from the server
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mpd_client-0.0.6 | examples/search_and_replace_playlist.rb |