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
wesrog (author)
Wed Aug 20 22:20:58 -0700 2008
commit  9e2266dc67eb86320a1e947a28f9002740142036
tree    92b47d734718cfd24f825a94e467dd2720d460e9
parent  f813604384d5ff4cf2e545337e5c24c595fd3ed0
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