Project

kagu

0.0
Low commit activity in last 3 years
No release in over a year
API to manage macOS Music tracks and playlists
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.2.0, < 12.0.0
>= 10.3.0, < 14.0.0
>= 3.1.0, < 3.11.0
>= 1.25.0, < 2.0.0
>= 0.6.0, < 1.0.0
>= 2.8.0, < 3.0.0

Runtime

>= 7.0.0, < 8.0.0
>= 1.0, < 2.0
>= 2.7.0, < 3.0.0
 Project Readme

Kagu

Ruby API to manage macOS Music tracks and playlists.

Important note for macOS Catalina (10.15) users: Apple dropped automatic XML library export you need to manually export your XML library to $HOME/Music/iTunes/iTunes Music Library.xml path to make kagu work properly.

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).