class GetSongs(NSObject):

    def getMySongs_(self, song):
        song_details = {}
ui = song.userInfo()
for x in ui:
    song_details[x] = ui.objectForKey_(x)
print(song_details)
nc = Foundation.NSDistributedNotificationCenter.defaultCenter()
GetSongs = GetSongs.new()
nc.addObserver_selector_name_object_(GetSongs, 'getMySongs:',
    'com.apple.iTunes.playerInfo', None)
NSLog('Listening for new tunes....')
AppHelper.runConsoleEventLoop()
How do you listen to notifications from iTunes on a Mac (Using the NSDistributedNotificationCenter)