Skip to content

Instantly share code, notes, and snippets.

@inket
Created July 16, 2014 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inket/531f64812950036b4345 to your computer and use it in GitHub Desktop.
Save inket/531f64812950036b4345 to your computer and use it in GitHub Desktop.
#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