currentSongTitle now returns the stream title of a streaming radio
[MenuTunes.git] / iTunesRemote.m
index 0a1335e..46a01f3 100755 (executable)
 {
     int temp1;
     ITDebugLog(@"Getting current song index.");
+    
+    if ([self currentSource] == ITMTRemoteRadioSource)
+    
     temp1 = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pidx" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
     ITDebugLog(@"Getting current song index done.");
     return temp1;
 {
     NSString *temp1;
     ITDebugLog(@"Getting current song title.");
-    temp1 = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pnam" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+    
+    //If we're listening to the radio.
+    if ([[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pcls" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] == 'cURT') {
+        temp1 = [[[ITAppleEventCenter sharedCenter] sendAEWithRequestedKey:@"pStT" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] stringByAppendingString:@" (Stream)"];
+    } else {
+        temp1 = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pnam" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+    }
     ITDebugLog(@"Getting current song title done.");
     return ( ([temp1 length]) ? temp1 : nil ) ;
 }