Bypass sending notifications to Growl if Last.fm is enabled and running, as Last.fm has its own display notifications
parent
2655f22b7d
commit
9d6f583eff
|
@ -53,6 +53,7 @@
|
|||
if (NO == [pe error]) {
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"enableAudioScrobbler"]) {
|
||||
[scrobbler start:pe];
|
||||
if ([AudioScrobbler isRunning]) return;
|
||||
}
|
||||
|
||||
// Note: We don't want to send a growl notification on resume.
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
semaphore_t _semaphore;
|
||||
}
|
||||
|
||||
+ (BOOL) isRunning;
|
||||
|
||||
- (void) start:(PlaylistEntry *)pe;
|
||||
- (void) stop;
|
||||
- (void) pause;
|
||||
|
|
|
@ -67,6 +67,20 @@ escapeForLastFM(NSString *string)
|
|||
|
||||
@implementation AudioScrobbler
|
||||
|
||||
+ (BOOL) isRunning
|
||||
{
|
||||
NSArray *launchedApps = [[NSWorkspace sharedWorkspace] runningApplications];
|
||||
BOOL running = NO;
|
||||
for(NSRunningApplication *app in launchedApps) {
|
||||
if([[app bundleIdentifier] isEqualToString:@"fm.last.Last.fm"] ||
|
||||
[[app bundleIdentifier] isEqualToString:@"fm.last.Scrobbler"]) {
|
||||
running = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return running;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if((self = [super init])) {
|
||||
|
@ -74,18 +88,8 @@ escapeForLastFM(NSString *string)
|
|||
_pluginID = @"cog";
|
||||
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"automaticallyLaunchLastFM"]) {
|
||||
|
||||
NSArray *launchedApps = [[NSWorkspace sharedWorkspace] runningApplications];
|
||||
BOOL running = NO;
|
||||
for(NSRunningApplication *app in launchedApps) {
|
||||
if([[app bundleIdentifier] isEqualToString:@"fm.last.Last.fm"] ||
|
||||
[[app bundleIdentifier] isEqualToString:@"fm.last.Scrobbler"]) {
|
||||
running = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!running) {
|
||||
|
||||
if(![AudioScrobbler isRunning]) {
|
||||
[[NSWorkspace sharedWorkspace] launchApplication:@"Last.fm.app"];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue