Improve iTunes Store season matching, avoid getting season 10 instead of 1.
This commit is contained in:
1 parent
8a734e0f85
commit
8bfe2829ef
1 file changed
+3
-3
@@ -183,11 +183,11 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
// Determine artistId/collectionId
|
// Determine artistId/collectionId
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
if (aSeasonNum.length) {
|
if (aSeasonNum.length) {
|
||||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=tvSeasonTerm&entity=tvSeason&limit=200",
|
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=tvSeasonTerm&entity=tvSeason&limit=250",
|
||||||
country, language.lowercaseString, [SBMetadataHelper urlEncoded:[NSString stringWithFormat:@"%@ %@ %@", aSeriesName, season, aSeasonNum]]]];
|
country, language.lowercaseString, [SBMetadataHelper urlEncoded:[NSString stringWithFormat:@"%@ %@ %@", aSeriesName, season, aSeasonNum]]]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=showTerm&entity=tvShow&limit=200",
|
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=showTerm&entity=tvShow&limit=250",
|
||||||
country, language.lowercaseString, [SBMetadataHelper urlEncoded:aSeriesName]]];
|
country, language.lowercaseString, [SBMetadataHelper urlEncoded:aSeriesName]]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
|
|||||||
NSString *showPattern = [[show stringByReplacingOccurrencesOfString:@" " withString:@".*?" 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];
|
NSRegularExpression *showRegex = [NSRegularExpression regularExpressionWithPattern:showPattern options:NSRegularExpressionCaseInsensitive error:nil];
|
||||||
|
|
||||||
NSString *seasonPattern = [NSString stringWithFormat:@"%@\\s%@", seasonString, season];
|
NSString *seasonPattern = [NSString stringWithFormat:@"%@\\s%@$", seasonString, season];
|
||||||
NSRegularExpression *seasonRegex = [NSRegularExpression regularExpressionWithPattern:seasonPattern options:NSRegularExpressionCaseInsensitive error:nil];
|
NSRegularExpression *seasonRegex = [NSRegularExpression regularExpressionWithPattern:seasonPattern options:NSRegularExpressionCaseInsensitive error:nil];
|
||||||
|
|
||||||
if (resultsArray == nil || ![resultsArray isKindOfClass:[NSArray class]]) {
|
if (resultsArray == nil || ![resultsArray isKindOfClass:[NSArray class]]) {
|
||||||
|
|||||||
Reference in new issue
Block a user