Class: Kanye::ITunes
Instance Method Summary collapse
- #add_to_playlist(file, playlist_name) ⇒ Object
- #create_playlist(name) ⇒ Object
- #playlist(name) ⇒ Object
Instance Method Details
#add_to_playlist(file, playlist_name) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/kanye/itunes.rb', line 7 def add_to_playlist(file, playlist_name) list = playlist(playlist_name) || create_playlist(playlist_name) raise "Playlist could not be found or created" unless list track = itunes.add MacTypes::Alias.path(file) track.duplicate(:to => list) if track end |
#create_playlist(name) ⇒ Object
18 19 20 |
# File 'lib/kanye/itunes.rb', line 18 def create_playlist(name) itunes.make(:new => :user_playlist, :with_properties => {:name => name}) end |
#playlist(name) ⇒ Object
14 15 16 |
# File 'lib/kanye/itunes.rb', line 14 def playlist(name) itunes.user_playlists[its.name.eq(name)].get.first end |