X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/6f3e95b38759c72706e83ff140ae17667cdfad22..d2a384947ca515dfbdc114c326e7ac4667c0397e:/iTunesRemote.m?ds=inline diff --git a/iTunesRemote.m b/iTunesRemote.m index b5365b2..dbd21fb 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -351,6 +351,7 @@ newParent = test; } } + [[[nextNode parent] children] removeObject:nextNode]; [nextNode setParent:newParent]; [[newParent children] addObject:nextNode]; [newParent setType:ITMTFolderNode]; @@ -361,6 +362,7 @@ NSEnumerator *nestEnumerator = [nested objectEnumerator]; while ( (nextNode = [nestEnumerator nextObject]) ) { [[sourceNode children] removeObject:nextNode]; + [nested removeObject:nextNode]; } [nested release]; @@ -370,12 +372,10 @@ 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]; } @@ -389,7 +389,7 @@ - (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; @@ -407,7 +407,7 @@ - (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; @@ -670,6 +670,24 @@ return temp2; } +- (int)currentSongPlayed +{ + UInt32 final; + ITDebugLog(@"Getting current song played time."); + final = [ITSendAEWithKey('pPos', 'core', 'getd', &savedPSN) int32Value]; + ITDebugLog(@"Getting current song played time done."); + return final; +} + +- (int)currentSongDuration +{ + SInt32 temp1; + ITDebugLog(@"Getting current song duration."); + temp1 = [ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pDur'), from:obj { form:'prop', want:type('prop'), seld:type('pTrk'), from:'null'() } }", 'core', 'getd', &savedPSN) int32Value]; + ITDebugLog(@"Getting current song duration done."); + return temp1; +} + - (NSString *)currentSongRemaining { SInt32 duration, current, final; @@ -705,7 +723,7 @@ { ITDebugLog(@"Getting current song album art."); NSData *data = ([self isPlaying]) ? [ITSendAEWithString(@"'----':obj { form:'prop', want:type('prop'), seld:type('pPCT'), from:obj { form:'indx', want:type('cArt'), seld:long(1), from:obj { form:'prop', want:type('prop'), seld:type('pTrk'), from:'null'() } } }", 'core', 'getd', &savedPSN) data] : nil; - ITDebugLog(@"Getting current song album art done."); + ITDebugLog(@"Getting current song album art done."); if (data) { return [[[NSImage alloc] initWithData:data] autorelease]; } else { @@ -1074,6 +1092,7 @@ 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];