Net::DAAP
This library is used for browsing iTunes DAAP servers.
Most of this is based off the work in the perl version by Richard Clamp which can be found here:
Ruby version is by Aaron Patterson <[email protected]>
Installation
Make sure that Digest::M4P is installed before using this package. Digest::M4P is available on the daap client ruby forge site:
rubyforge.org/frs/?group_id=1155
Digest::M4P has not been turned in to a Ruby gem as of this writing.
After that, just install the gem:
sudo gem install daapclient
Also, check out the project page:
rubyforge.org/projects/daapclient
Example Usage
require 'net/daap'
require 'fileutils'
daap = Net::DAAP::Client.new('localhost')
daap.connect do |dsn|
daap.databases do |db|
puts "All songs in the database"
db.songs do |song|
filename = "#{song.artist} - #{song.name}.#{song.format}"
directory = "db/#{song.album}"
FileUtils::mkdir_p(directory)
File.open("#{directory}/#{filename}", "w") do |f|
song.get { |str| f.write str }
end
end
end
end
Acknowledgements
The library is mostly a port of the Perl library, and owes most of its communication logic to the original Perl version by Richard Clamp.
Author
This Ruby version is Copyright © Aaron Patterson 2005
It also comes with a shameless plug for employment coding Ruby, my most favorite language! ;-)
License
This library is distributed under the GPL. Please see the LICENSE file.