The song title stream version is now much better. It shows the stream
[MenuTunes.git] / iTunesRemote.m
index 0a1335e..ad8a4b8 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') {
+        NSString *bad = [NSString stringWithUTF8String:"浳湧"];
+        temp1 = [[ITAppleEventCenter sharedCenter] sendAEWithRequestedKey:@"pStT" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+        if ([temp1 isEqualToString:bad]) {
+            temp1 = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pnam" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+        }
+        temp1 = [temp1 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 ) ;
 }