API to manage iTunes tracks and playlists
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
MIT-LICENSE
README.mdown
Rakefile
VERSION
kagu.gemspec

README.mdown

Kagu

Ruby API to manage iTunes tracks and playlists.

Installation

Just add this into your Gemfile:

gem 'kagu'

Then, just run bundle install.

Examples

Displaying all tracks artist

library = Kagu::Library.new

library.tracks.each do |track|
  puts track.artist
end

Displaying all playlists and its tracks count

library = Kagu::Library.new

library.playlists.each do |playlist|
  puts "#{playlist.name}: #{playlist.tracks.count}"
end

Creating a playlist

library = Kagu::Library.new

tracks = library.tracks.select { |track| track.genre == 'Drum & Bass' && track.added_at > 1.week.ago }
library.playlists.create(name: 'Recent - D&B', tracks: tracks)

Finding some tracks

library = Kagu::Library.new
library.finder.find(artist: 'Serial Killaz', title: 'Walk and Skank').each do
  puts track.id
end

Configuring logger

In order to have some debug informations about what kagu does, you could configure its logger:

Kagu.logger = Logger.new(STDERR)

Executing test suite

This project is fully tested with Rspec 3. Just run bundle exec rake (after a bundle install).