Loosen up show name validation. Validate results in

showOrSeasonIdFromResults:
This commit is contained in:
Janos Kis committed 2017-03-09 21:01:51 +00:00
1 parent f5beebf154
commit adba28a54f
1 file changed
+6 -1
+6 -1
View File
@@ -362,12 +362,17 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
NSInteger showOrSeasonId = 0;
NSArray *resultsArray = dict[@"results"];
NSString *showPattern = [[show stringByReplacingOccurrencesOfString:@" " withString:@"\\s?" options:0 range:NSMakeRange(0, [show length])] lowercaseString];
NSString *showPattern = [[show stringByReplacingOccurrencesOfString:@" " withString:@".*?" options:0 range:NSMakeRange(0, [show length])] lowercaseString];
NSRegularExpression *showRegex = [NSRegularExpression regularExpressionWithPattern:showPattern options:NSRegularExpressionCaseInsensitive error:nil];
NSString *seasonPattern = [NSString stringWithFormat:@"%@\\s%@", seasonString, season];
NSRegularExpression *seasonRegex = [NSRegularExpression regularExpressionWithPattern:seasonPattern options:NSRegularExpressionCaseInsensitive error:nil];
if ([resultsArray isEqual:nil]) {
return showOrSeasonId;
}
for (NSDictionary<NSString *, id> *r in resultsArray) {
// Skip if the result is not a collection or artist