*/
- (ITMTRemotePlayerSource)currentSource;
+/*!
+ * @method currentSourceIndex
+ */
+- (int)currentSourceIndex;
+
/*!
* @method currentPlaylistClass
*/
*/
- (BOOL)switchToPlaylistAtIndex:(int)index;
+/*!
+ * @method switchToPlaylistAtIndex:
+ */
+- (BOOL)switchToPlaylistAtIndex:(int)index ofSourceAtIndex:(int)index2;
+
/*!
* @method switchToSongAtIndex:
*/
return nil;
}
+- (int)currentSourceIndex
+{
+ return nil;
+}
+
- (ITMTRemotePlayerPlaylistClass)currentPlaylistClass
{
return nil;
return NO;
}
+- (BOOL)switchToPlaylistAtIndex:(int)index ofSourceAtIndex:(int)index2
+{
+ return NO;
+}
+
- (BOOL)switchToSongAtIndex:(int)index
{
return NO;
{
ITDebugLog(@"Selecting playlist %i", index);
NS_DURING
- [[self currentRemote] switchToPlaylistAtIndex:(index / 1000) ofSourceAtIndex:(index % 1000)];
+ [[self currentRemote] switchToPlaylistAtIndex:(index % 1000) ofSourceAtIndex:(index / 1000)];
NS_HANDLER
[self networkError:localException];
NS_ENDHANDLER
}
}
- [playlistsMenu addItem:[NSMenuItem separatorItem]];
+ if ( (source == ITMTRemoteRadioSource) || ([playlists count] - 2 > 0) ) {
+ [playlistsMenu addItem:[NSMenuItem separatorItem]];
+ }
+
+ if (source == ITMTRemoteRadioSource) {
+ [[playlistsMenu addItemWithTitle:NSLocalizedString(@"radio", @"Radio") action:@selector(performPlaylistMenuAction:) keyEquivalent:@""] setState:NSOnState];
+ }
- for (i = 1; i < [playlists count]; i++) {
+ for (i = 2; i < [playlists count]; i++) {
NSArray *curPlaylist = [playlists objectAtIndex:i];
NSString *name = [curPlaylist objectAtIndex:0];
NSMenu *submenu = [[NSMenu alloc] init];
for (j = 1; j < [curPlaylist count]; j++) {
ITDebugLog(@"Adding playlist: %@", [curPlaylist objectAtIndex:j]);
tempItem = [submenu addItemWithTitle:[curPlaylist objectAtIndex:j] action:@selector(performPlaylistMenuAction:) keyEquivalent:@""];
- [tempItem setTag:(j * 1000) + (j + 1)];
+ [tempItem setTag:(i * 1000) + (j + 1)];
[tempItem setTarget:self];
}
[[playlistsMenu addItemWithTitle:name action:NULL keyEquivalent:@""] setSubmenu:[submenu autorelease]];
}
- /*if (source == ITMTRemoteRadioSource) {
- [[playlistsMenu addItemWithTitle:NSLocalizedString(@"radio", @"Radio") action:NULL keyEquivalent:@""] setState:NSOnState];
- } else if (source == ITMTRemoteGenericDeviceSource) {
- [[playlistsMenu addItemWithTitle:NSLocalizedString(@"genericDevice", @"Generic Device") action:NULL keyEquivalent:@""] setState:NSOnState];
- } else if (source == ITMTRemoteiPodSource) {
- [[playlistsMenu addItemWithTitle:NSLocalizedString(@"iPod", @"iPod") action:NULL keyEquivalent:@""] setState:NSOnState];
- } else if (source == ITMTRemoteCDSource) {
- [[playlistsMenu addItemWithTitle:NSLocalizedString(@"cd", @"CD") action:NULL keyEquivalent:@""] setState:NSOnState];
- } else if (source == ITMTRemoteSharedLibrarySource) {
- [[playlistsMenu addItemWithTitle:NSLocalizedString(@"sharedLibrary", @"Shared Library") action:NULL keyEquivalent:@""] setState:NSOnState];
+
+ if ( (source == ITMTRemoteSharedLibrarySource) || (source == ITMTRemoteiPodSource) || (source == ITMTRemoteGenericDeviceSource) || (source == ITMTRemoteCDSource) ){
+ tempItem = [playlistsMenu itemAtIndex:(int)[[[MainController sharedController] currentRemote] currentSourceIndex] + [playlistsMenu numberOfItems] - 6];
+ [tempItem setState:NSOnState];
+ [[[tempItem submenu] itemAtIndex:_currentPlaylist - 1] setState:NSOnState];
} else if (source == ITMTRemoteLibrarySource && _currentPlaylist) {
[[playlistsMenu itemAtIndex:_currentPlaylist - 1] setState:NSOnState];
- }*/
+ }
ITDebugLog(@"Done Building \"Playlists\" menu");
return playlistsMenu;
}
}
}
+- (int)currentSourceIndex
+{
+ ITDebugLog(@"Getting current source.");
+ return [[ITAppleEventCenter sharedCenter] sendAEWithSendStringForNumber:[NSString stringWithFormat:@"'----':obj { form:'prop', want:type('prop'), seld:type('pidx'), from:obj { form:'prop', want:type('prop'), seld:type('ctnr'), from:obj { form:'prop', want:type('prop'), seld:type('pPla'), from:'null'() } } }"] eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
+}
+
- (ITMTRemotePlayerPlaylistClass)currentPlaylistClass
{
int realResult = [[ITAppleEventCenter sharedCenter] sendTwoTierAEWithRequestedKeyForNumber:@"pcls" fromObjectByKey:@"pPla" eventClass:@"core" eventID:@"getd" appPSN:savedPSN];
- (BOOL)switchToPlaylistAtIndex:(int)index
{
ITDebugLog(@"Switching to playlist at index %i", index);
- [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:() }",index] eventClass:@"hook" eventID:@"Play" appPSN:savedPSN];
+ [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:() }", index] eventClass:@"hook" eventID:@"Play" appPSN:savedPSN];
ITDebugLog(@"Done switching to playlist at index %i", index);
return YES;
}
- (BOOL)switchToPlaylistAtIndex:(int)index ofSourceAtIndex:(int)index2
{
ITDebugLog(@"Switching to playlist at index %i of source %i", index, index2);
- [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:obj { form:'indx', want:type('cSrc'), seld:long('%lu'), from:() } }",index, index2] eventClass:@"hook" eventID:@"Play" appPSN:savedPSN];
- //[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from:'null'() }, data:obj { form:'indx', want:type('cSrc'), seld:long('%lu'), from:'null'() }",index, index2]
+ [[ITAppleEventCenter sharedCenter] sendAEWithSendString:[NSString stringWithFormat:@"'----':obj { form:'indx', want:type('cPly'), seld:long(%lu), from: obj { form:'indx', want:type('cSrc'), seld:long(%lu), from:'null'() } }", index - 1, index2 + 1] eventClass:@"hook" eventID:@"Play" appPSN:savedPSN];
+ //{ form:'indx', want:type('cPly'), seld:long(%lu), from:obj { form:'indx', want:type('cSrc'), seld:long('%lu'), from:'null'() } } -- obj { form:'indx', want:type('cSrc'), seld:long(1), from:'null'() }
ITDebugLog(@"Done switching to playlist at index %i of source %i", index, index2);
return YES;
}