From: Joseph Spiros Date: Wed, 1 Oct 2003 10:51:03 +0000 (+0000) Subject: OK, I fixed the currentSource stuff... we were formerly on the wrong X-Git-Tag: v1.0~36 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/cfe2c029d37ca99332c794092229e97bd86d4ddd OK, I fixed the currentSource stuff... we were formerly on the wrong track, getting the kind of the CURRENT TRACK. now, we're getting the kind of the current playlist's container (which just so happens to be it's source :) ) --- diff --git a/ITMTRemote.h b/ITMTRemote.h index f783204..e296bdd 100755 --- a/ITMTRemote.h +++ b/ITMTRemote.h @@ -279,6 +279,11 @@ er's process managment. */ - (NSString *)currentSongRemaining; +/*! + * @method currentSongElapsed + */ +- (NSString *)currentSongElapsed; + /*! * @method currentSongRating */ diff --git a/ITMTRemote.m b/ITMTRemote.m index bd7e106..8cb5178 100755 --- a/ITMTRemote.m +++ b/ITMTRemote.m @@ -154,6 +154,11 @@ return nil; } +- (NSString *)currentSongElapsed +{ + return nil; +} + - (float)currentSongRating { return nil; diff --git a/iTunesRemote.m b/iTunesRemote.m index fe6e1a2..f2dcc67 100755 --- a/iTunesRemote.m +++ b/iTunesRemote.m @@ -157,7 +157,11 @@ ITDebugLog(@"Getting current source."); + + fourcc = [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber :[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pKnd'), from:obj { form:'prop', want:type('prop'), seld:type('cntr'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }",index] eventClass:@"core" eventID:@"getd" appPSN:savedPSN]; + fourcc = (unsigned long)[[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKey:@"pKnd" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN]; + switch (fourcc) { case 'kTun': ITDebugLog(@"Getting current source done. Source: Radio."); @@ -320,6 +324,18 @@ return [[NSNumber numberWithLong:duration - current] stringValue]; } +- (NSString *)currentSongElapsed +{ + long current; + + ITDebugLog(@"Getting current song elapsed time."); + + current = [[ITAppleEventCenter sharedCenter] + sendAEWithRequestedKeyForNumber:@"pPos" eventClass:@"core" eventID:@"getd" appPSN:savedPSN]; + ITDebugLog(@"Getting current song elapsed time done."); + return [[NSNumber numberWithLong:current] stringValue]; +} + - (float)currentSongRating { float temp1; @@ -399,10 +415,17 @@ - (BOOL)shuffleEnabled { ITDebugLog(@"Getting shuffle enabled status."); + BOOL final; int result = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pShf" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:savedPSN]; + if (result != 0) { + final = YES; + } else { + final = NO; + } + NSLog(@"shuffleEnabled: final = %i", final); ITDebugLog(@"Getting shuffle enabled status done."); - return result; + return final; } - (BOOL)setShuffleEnabled:(BOOL)enabled diff --git a/libValidate.a b/libValidate.a index 03604fa..d2a54bb 100755 Binary files a/libValidate.a and b/libValidate.a differ