Merged in JohnKis/subler (pull request #15)

Loosen up show name validation
This commit is contained in:
János Kis authored and Damiano Galassi committed 2017-03-10 07:02:02 +00:00
commit f3ace7b913
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