Upped the timeout for the albums and artist method to 600.
[MenuTunes.git] / iTunesRemote.m
index b5365b2..bfd8a47 100755 (executable)
                                                newParent = test;
                                        }
                                }
+                               [[[nextNode parent] children] removeObject:nextNode];
                                [nextNode setParent:newParent];
                                [[newParent children] addObject:nextNode];
                                [newParent setType:ITMTFolderNode];
                NSEnumerator *nestEnumerator = [nested objectEnumerator];
                while ( (nextNode = [nestEnumerator nextObject]) ) {
                        [[sourceNode children] removeObject:nextNode];
+                       [nested removeObject:nextNode];
                }
                [nested release];
                
                enumerator = [[sourceNode children] reverseObjectEnumerator];
                while ( (nextNode = [enumerator nextObject]) ) {
                        if ([nextNode type] == ITMTPodcastsNode) {
-                               [nextNode retain];
                                [[sourceNode children] removeObject:nextNode];
                                [[sourceNode children] insertObject:nextNode atIndex:1];
                                movedPodcasts = YES;
                        } else if ([nextNode type] == ITMTFolderNode) {
-                               [nextNode retain];
                                [[sourceNode children] removeObject:nextNode];
                                [[sourceNode children] insertObject:nextNode atIndex:1 + movedPodcasts];
                        }
 
 - (NSArray *)artists
 {
-    NSAppleEventDescriptor *rawr = ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pArt'), from:obj { form:'indx', want:type('cTrk'), seld:abso($616C6C20$), from:obj { form:'indx', want:type('cPly'), seld:long(1), from:obj { form:'indx', want:type('cSrc'), seld:long(1), from:() } } } }", 'core', 'getd', &savedPSN);
+    NSAppleEventDescriptor *rawr = ITSendAEWithStringAndTimeout(@"'----':obj { form:'prop', want:type('prop'), seld:type('pArt'), from:obj { form:'indx', want:type('cTrk'), seld:abso($616C6C20$), from:obj { form:'indx', want:type('cPly'), seld:long(1), from:obj { form:'indx', want:type('cSrc'), seld:long(1), from:() } } } }", 'core', 'getd', &savedPSN, 600);
     int i;
     NSMutableArray *array = [[NSMutableArray alloc] init];
     NSArray *returnArray;
 
 - (NSArray *)albums
 {
-    NSAppleEventDescriptor *rawr = ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pAlb'), from:obj { form:'indx', want:type('cTrk'), seld:abso($616C6C20$), from:obj { form:'indx', want:type('cPly'), seld:long(1), from:obj { form:'indx', want:type('cSrc'), seld:long(1), from:() } } } }", 'core', 'getd', &savedPSN);
+    NSAppleEventDescriptor *rawr = ITSendAEWithStringAndTimeout(@"'----':obj { form:'prop', want:type('prop'), seld:type('pAlb'), from:obj { form:'indx', want:type('cTrk'), seld:abso($616C6C20$), from:obj { form:'indx', want:type('cPly'), seld:long(1), from:obj { form:'indx', want:type('cSrc'), seld:long(1), from:() } } } }", 'core', 'getd', &savedPSN, 600);
     int i;
     NSMutableArray *array = [[NSMutableArray alloc] init];
     NSArray *returnArray;
                 ITDebugLog(@"iTunes' highLPongOfPSN: %lu.", number.highLongOfPSN);
                 ITDebugLog(@"iTunes' lowLongOfPSN: %lu.", number.lowLongOfPSN);
                 ITDebugLog(@"Done getting iTunes' PSN.");
+                               [(NSString *)name release];
                 return number;
             }
             [(NSString *)name release];