From: Joseph Spiros Date: Sat, 6 Sep 2003 22:26:59 +0000 (+0000) Subject: Some more work on the iTunes remote... I'm starting to require testing, X-Git-Tag: v1.0~77 X-Git-Url: http://git.ithinksw.org/MenuTunes.git/commitdiff_plain/8efcef7c4932a46bf349f8c6df04887f78b57914 Some more work on the iTunes remote... I'm starting to require testing, so less work will be done on the iTunes remote until the MT application uses remotes that use the new API. --- diff --git a/iTunesPlayer.h b/iTunesPlayer.h index 59e0e54..ab8505b 100755 --- a/iTunesPlayer.h +++ b/iTunesPlayer.h @@ -7,7 +7,7 @@ // #import - +#import #import @interface iTunesPlayer : ITMTPlayer { diff --git a/iTunesPlayer.m b/iTunesPlayer.m index cb6eb94..1c7f225 100755 --- a/iTunesPlayer.m +++ b/iTunesPlayer.m @@ -47,12 +47,21 @@ static iTunesPlayer *_sharediTunesPlayer = nil; } - (ITMTPlaylist *)currentPlaylist { - // return dynamically from an AE - // (ie - [iTunesPlaylist playlistForIndex:] + int tIndex; + if ( ( tIndex = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pidx" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] ) ) { + return [iTunesPlaylist playlistWithIndex:tIndex]; + } else { + return nil; + } } - (ITMTTrack *)currentTrack { - // return dynamically from an AE + int tDIndex; + if ( ( tDindex = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pDID" fromObjectByKey:@"pTrk" eventClass:@"core" eventID:@"getd" appPSN:savedPSN] ) ) { + return [iTunesTrack trackWithDatabaseIndex:tDIndex]; + } else { + return nil; + } } - (ITMTEqualizer *)currentEqualizer { diff --git a/iTunesPlaylist.h b/iTunesPlaylist.h index 0a0d515..ae7ada9 100755 --- a/iTunesPlaylist.h +++ b/iTunesPlaylist.h @@ -9,8 +9,9 @@ #import -@interface iTunesPlaylist : NSObject { - +@interface iTunesPlaylist : ITMTPlaylist { + int _index; } - ++ (id)playlistWithIndex:(int)index; +- (id)initWithIndex:(int)index; @end diff --git a/iTunesPlaylist.m b/iTunesPlaylist.m index f571ba7..60c01a5 100755 --- a/iTunesPlaylist.m +++ b/iTunesPlaylist.m @@ -11,7 +11,15 @@ @implementation iTunesPlaylist -+ (id)playlistForIndex:(int)index { ++ (id)playlistWithIndex:(int)index { + return [[[iTunesPlaylist alloc] initWithIndex:index] autorelease]; +} + +- (id)initWithIndex:(int)index { + if ( ( self = [super init] ) ) { + _index = index; + } + return self; } @end diff --git a/iTunesTrack.h b/iTunesTrack.h new file mode 100755 index 0000000..920c1fb --- /dev/null +++ b/iTunesTrack.h @@ -0,0 +1,17 @@ +// +// iTunesTrack.h +// MenuTunes +// +// Created by Joseph Spiros on Sat Sep 06 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface iTunesTrack : ITMTTrack { + int _index; +} ++ (id)trackWithDatabaseIndex:(int)index; +- (id)initWithDatabaseIndex:(int)index; +@end diff --git a/iTunesTrack.m b/iTunesTrack.m new file mode 100755 index 0000000..7b3a813 --- /dev/null +++ b/iTunesTrack.m @@ -0,0 +1,24 @@ +// +// iTunesTrack.m +// MenuTunes +// +// Created by Joseph Spiros on Sat Sep 06 2003. +// Copyright (c) 2003 __MyCompanyName__. All rights reserved. +// + +#import "iTunesTrack.h" + +@implementation iTunesTrack + ++ (id)trackWithDatabaseIndex:(int)index { + return [[[iTunesTrack alloc] initWithIndex:index] autorelease]; +} + +- (id)initWithDatabaseIndex:(int)index { + if ( ( self = [super init] ) ) { + _index = index; + } + return self; +} + +@end