public
Description: A simple RubyCocoa app that writes popular last.fm tags as genres to your iTunes library.
Homepage: http://www.633k.net/labels/lastfmtaggercocoa.html
Clone URL: git://github.com/wesrog/last.fm-tagger.git
last.fm-tagger / PlaylistsController.rb
100644 26 lines (21 sloc) 0.69 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#
# PlaylistsArray.rb
# last.fm-tagger
#
# Created by Wes Rogers on 7/5/08.
# Copyright (c) 2008 633k.net. All rights reserved.
#
 
class PlaylistsController < NSArrayController
  ib_outlets :playlistsPopUp
  ib_action :reloadPlaylists
  
  def initialize
    @iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")
  end
  
  def awakeFromNib
    @playlistsPopUp.addItemsWithTitles(@iTunes.sources.first.userPlaylists.reject { |p| p.smart == 1 }.map { |p| p.name })
  end
  
  def reloadPlaylists
    @playlistsPopUp.removeAllItems
    @playlistsPopUp.addItemsWithTitles(@iTunes.sources.first.userPlaylists.reject { |p| p.smart == 1 }.map { |p| p.name })
  end
end