-
-
Save inket/531f64812950036b4345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
BOOL keepAlive = [[[NSProcessInfo processInfo] arguments] containsObject:@"-b"]; | |
if (keepAlive) | |
{ | |
[[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"me.inket.HAPU.streamdetection.quit" | |
object:nil | |
queue:nil | |
usingBlock:^(NSNotification *note) { | |
CFRunLoopStop(CFRunLoopGetCurrent()); | |
}]; | |
[[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"me.inket.HAPU.streamdetection.request" | |
object:nil | |
queue:nil | |
usingBlock:^(NSNotification *note) { | |
NSDictionary* userInfo = @{ | |
@"service": @"Crunchyroll", | |
@"anime": @"Naruto Shippuden", | |
@"browser": @"Safari", | |
@"episode": @250 | |
}; /* change this so it's dynamic, by getting the info from your browser */ | |
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"me.inket.HAPU.streamdetection.response" | |
object:nil | |
userInfo:userInfo | |
deliverImmediately:YES]; | |
}]; | |
CFRunLoopRun(); | |
} | |
else | |
{ | |
// you probably don't need this | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment