trackInfoIndex = -1;
lastSongIndex = -1;
- didHaveAlbumName = ([[self runScriptAndReturnResult:@"return album of current track"] length] > 0);
- didHaveArtistName = ([[self runScriptAndReturnResult:@"return artist of current track"] length] > 0);
-
+ didHaveAlbumName = ([[currentRemote currentSongAlbum] length] > 0);
+ didHaveArtistName = ([[currentRemote currentSongArtist] length] > 0);
while ([menu numberOfItems] > 0) {
[menu removeItemAtIndex:0];
if (!isPlayingRadio) {
if ([defaults boolForKey:@"showTime"]) {
- menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", [self runScriptAndReturnResult:@"return time of current track"]]
+ menuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@" %@", [currentRemote currentSongLength]]
action:nil
keyEquivalent:@""];
[menu insertItem:menuItem atIndex:trackInfoIndex + 1];
}
//Update Play/Pause menu item
if (playPauseMenuItem){
- if ([[self runScriptAndReturnResult:@"return player state"] isEqualToString:@"playing"]) {
+ if ([currentRemote playerState] == playing) {
[playPauseMenuItem setTitle:@"Pause"];
} else {
[playPauseMenuItem setTitle:@"Play"];
- (void)playPause:(id)sender
{
- NSString *state = [self runScriptAndReturnResult:@"return player state"];
- NSLog(@"%i", [currentRemote playerState]);
- if ([state isEqualToString:@"playing"]) {
- [currentRemote play];
+ PlayerState state = [currentRemote playerState];
+ if (state == playing) {
+ [currentRemote pause];
[playPauseMenuItem setTitle:@"Play"];
- } else if ([state isEqualToString:@"fast forwarding"] || [state
-isEqualToString:@"rewinding"]) {
+ } else if ((state == forwarding) || (state == rewinding)) {
[currentRemote play];
[currentRemote pause];
} else {
- (void)showCurrentTrackInfo
{
- NSString *trackName = [self runScriptAndReturnResult:@"return name of current track"];
+ NSString *trackName = [currentRemote currentSongTitle];
if (!statusController && [trackName length]) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *stringToShow = @"";