Net::DAAP
Version 0.0.1
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'
daap = Net::DAAP::Client.new('localhost')
daap.connect do |dsn|
daap.databases do |db|
puts "All songs in the database"
db.songs do |song|
puts "#{song.artist} - #{song.name}"
end
puts "Songs for each playlist"
db.playlists do |pl|
puts "Playlist name: #{pl.name}"
pl.songs do |song|
puts "#{song.artist} - #{song.name}"
File::open("db/#{song.artist} - #{song.name}.#{song.format}", "w") do |f|
f << song.get
end
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.