Fixed MT for iTunes 4.5 and the radio source possibly not existing.
[MenuTunes.git] / MainController.m
index e0230ff..ca0d38d 100755 (executable)
@@ -352,7 +352,7 @@ static MainController *sharedController;
             while ( (nextScript = [scriptsEnum nextObject]) ) {
                 NSDictionary *error;
                 NSAppleScript *currentScript = [[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/MenuTunes/Scripts"] stringByAppendingPathComponent:nextScript]] error:&error];
-                NSLog(@"Running script: %@", nextScript);
+                ITDebugLog(@"Running script: %@", nextScript);
                 if (!currentScript || ![currentScript executeAndReturnError:nil]) {
                     ITDebugLog(@"Error running script %@.", nextScript);
                 }
@@ -588,6 +588,11 @@ static MainController *sharedController;
 //
 //
 
+- (MenuController *)menuController
+{
+    return menuController;
+}
+
 - (void)closePreferences
 {
     ITDebugLog(@"Preferences closed.");
@@ -759,6 +764,7 @@ static MainController *sharedController;
     NSString               *title       = nil;
     NSString               *album       = nil;
     NSString               *artist      = nil;
+    NSString               *composer    = nil;
     NSString               *time        = nil;
     NSString               *track       = nil;
     NSImage                *art         = nil;
@@ -791,6 +797,14 @@ static MainController *sharedController;
             NS_ENDHANDLER
         }
 
+        if ( [df boolForKey:@"showComposer"] ) {
+            NS_DURING
+                composer = [[self currentRemote] currentSongComposer];
+            NS_HANDLER
+                [self networkError:localException];
+            NS_ENDHANDLER
+        }
+
         if ( [df boolForKey:@"showTime"] ) {
             NS_DURING
                 time = [NSString stringWithFormat:@"%@: %@ / %@",
@@ -853,6 +867,7 @@ static MainController *sharedController;
                                                    title:title
                                                    album:album
                                                   artist:artist
+                                                composer:composer
                                                     time:time
                                                    track:track
                                                   rating:rating