diff --git a/AppDelegate.m b/AppDelegate.m index 33cd4484..c7d75864 100644 --- a/AppDelegate.m +++ b/AppDelegate.m @@ -536,6 +536,10 @@ -(void)firetimer:(NSTimer *)aTimer { [self generateShareMenu]; } } + if (status == 51) { + //Show option to find title + [findtitle setHidden:false]; + } // Enable Menu Items scrobbleractive = false; [updatenow setEnabled:YES]; @@ -592,8 +596,6 @@ -(IBAction)showCorrectionSearchWindow:(id)sender{ //Get last scrobbled title [fsdialog setSearchField:[haengine getLastScrobbledTitle]]; } - // Set search field to search for the last scrobbled detected title - [fsdialog setSearchField:[haengine getLastScrobbledTitle]]; if (isVisible) { [self disableUpdateItems]; //Prevent user from opening up another modal window if access from Status Window [NSApp beginSheet:[fsdialog window] diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib index a0a21f07..5c1dc06d 100644 --- a/Base.lproj/MainMenu.xib +++ b/Base.lproj/MainMenu.xib @@ -1,8 +1,8 @@ - + - + @@ -290,7 +290,7 @@ - + @@ -400,10 +400,10 @@ - + - + @@ -531,10 +531,10 @@ Gw - + - + diff --git a/EasyNSURLConnection.m b/EasyNSURLConnection.m index 077da054..34f948fe 100644 --- a/EasyNSURLConnection.m +++ b/EasyNSURLConnection.m @@ -41,19 +41,25 @@ -(NSError *)getError{ #pragma mutators -(void)addHeader:(id)object forKey:(NSString *)key{ + NSLock * lock = [NSLock new]; // NSMutableArray is not Thread Safe, lock before performing operation + [lock lock]; if (formdata == nil) { //Initalize Header Data Array headers = [[NSMutableArray alloc] init]; } [headers addObject:[NSDictionary dictionaryWithObjectsAndKeys:object,key, nil]]; + [lock unlock]; //Finished operation, unlock } -(void)addFormData:(id)object forKey:(NSString *)key{ + NSLock * lock = [NSLock new]; // NSMutableArray is not Thread Safe, lock before performing operation + [lock lock]; if (formdata == nil) { //Initalize Form Data Array formdata = [[NSMutableArray alloc] init]; } [formdata addObject:[NSDictionary dictionaryWithObjectsAndKeys:object,key, nil]]; + [lock unlock]; //Finished operation, unlock } -(void)setUserAgent:(NSString *)string{ useragent = [NSString stringWithFormat:@"%@",string]; @@ -78,6 +84,8 @@ -(void)startRequest{ [request setTimeoutInterval:15]; // Set User Agent [request setValue:useragent forHTTPHeaderField:@"User-Agent"]; + NSLock * lock = [NSLock new]; // NSMutableArray is not Thread Safe, lock before performing operation + [lock lock]; // Set Other headers, if any if (headers != nil) { for (NSDictionary *d in headers ) { @@ -85,6 +93,7 @@ -(void)startRequest{ [request setValue:[[d allValues] objectAtIndex:0]forHTTPHeaderField:[[d allKeys] objectAtIndex:0]]; } } + [lock unlock]; NSError * rerror = nil; responsedata = [NSURLConnection sendSynchronousRequest:request returningResponse:&rresponse @@ -111,6 +120,8 @@ -(void)startFormRequest{ [request setValue:useragent forHTTPHeaderField:@"User-Agent"]; // Set Timeout [request setTimeoutInterval:15]; + NSLock * lock = [NSLock new]; // NSMutableArray is not Thread Safe, lock before performing operation + [lock lock]; //Set Post Data [request setHTTPBody:[self encodeArraywithDictionaries:formdata]]; // Set Other headers, if any @@ -120,6 +131,7 @@ -(void)startFormRequest{ [request setValue:[[d allValues] objectAtIndex:0]forHTTPHeaderField:[[d allKeys] objectAtIndex:0]]; } } + [lock unlock]; NSError * rerror; responsedata = [NSURLConnection sendSynchronousRequest:request returningResponse:&rresponse diff --git a/GeneralPrefController.m b/GeneralPrefController.m index 3b9f4f79..6a1ea554 100644 --- a/GeneralPrefController.m +++ b/GeneralPrefController.m @@ -130,13 +130,16 @@ -(IBAction)updateAutoExceptions:(id)sender{ dispatch_async(queue, ^{ // In a queue, download latest Auto Exceptions JSON, disable button until done and show progress wheel - [updateexceptionsbtn setEnabled:NO]; - [updateexceptionschk setEnabled:NO]; - [indicator startAnimation:self]; + dispatch_async(dispatch_get_main_queue(), ^{ + [updateexceptionsbtn setEnabled:NO]; + [updateexceptionschk setEnabled:NO]; + [indicator startAnimation:self];}); [AutoExceptions updateAutoExceptions]; - [indicator stopAnimation:self]; - [updateexceptionsbtn setEnabled:YES]; - [updateexceptionschk setEnabled:YES]; + dispatch_async(dispatch_get_main_queue(), ^{ + [indicator stopAnimation:self]; + [updateexceptionsbtn setEnabled:YES]; + [updateexceptionschk setEnabled:YES]; + }); dispatch_release(queue); }); diff --git a/Hachidori-Info.plist b/Hachidori-Info.plist index bde60c94..d4a1d698 100644 --- a/Hachidori-Info.plist +++ b/Hachidori-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1 + 1.1.1 CFBundleSignature ???? CFBundleVersion - 1.1 + 1.1.1 LSApplicationCategoryType public.app-category.entertainment LSMinimumSystemVersion diff --git a/Hachidori.m b/Hachidori.m index 63ad784d..6b8bf4b2 100644 --- a/Hachidori.m +++ b/Hachidori.m @@ -414,7 +414,16 @@ -(NSString *)findaniid:(NSData *)ResponseData searchterm:(NSString *) term{ } } //Return titleid if episode is valid - if ([searchentry objectForKey:@"episode_count"] == [NSNull null] || ([[NSString stringWithFormat:@"%@",[searchentry objectForKey:@"episode_count"]] intValue] >= [DetectedEpisode intValue])) { + int episodecount; + if ([searchentry objectForKey:@"episode_count"] == [NSNull null]) { + // No episode Count, set episode count to zero + episodecount = 0; + } + else{ + //Set Episode Count + episodecount = [[NSString stringWithFormat:@"%@", [searchentry objectForKey:@"episode_count"]] intValue]; + } + if (episodecount == 0 || ( episodecount >= [DetectedEpisode intValue])) { NSLog(@"Valid Episode Count"); if (sortedArray.count == 1 || DetectedSeason >= 2){ // Only Result, return diff --git a/Hachidori.xcodeproj/project.xcworkspace/xcuserdata/tailred.xcuserdatad/UserInterfaceState.xcuserstate b/Hachidori.xcodeproj/project.xcworkspace/xcuserdata/tailred.xcuserdatad/UserInterfaceState.xcuserstate index f160f7e2..3e37897a 100644 Binary files a/Hachidori.xcodeproj/project.xcworkspace/xcuserdata/tailred.xcuserdatad/UserInterfaceState.xcuserstate and b/Hachidori.xcodeproj/project.xcworkspace/xcuserdata/tailred.xcuserdatad/UserInterfaceState.xcuserstate differ