International iTunes Store might contains both localised and not "season" in the episode name.

This commit is contained in:
Damiano Galassi committed 2017-05-21 15:16:17 +02:00
1 parent 2c555069cf
commit ba9304122b
1 file changed
+6 -1
+6 -1
View File
@@ -229,7 +229,8 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
// If we have an ID, use the lookup API to get episodes for that show/season
if (iTunesID != 0) {
NSURL *lookupUrl;
lookupUrl = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/lookup?country=%@&id=%ld&entity=tvEpisode&limit=200", country, (long)iTunesID]];
lookupUrl = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/lookup?country=%@&id=%ld&entity=tvEpisode&limit=200",
country, (long)iTunesID]];
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:lookupUrl withCachePolicy:SBDefaultPolicy];
@@ -478,6 +479,10 @@ NSInteger sortSBMetadataResult(id ep1, id ep2, void *context)
if ([store[@"season"] length]) {
NSArray *sa = [s.lowercaseString componentsSeparatedByString:[NSString stringWithFormat:@", %@ ", store[@"season"]]];
if (sa.count <= 1) {
sa = [s.lowercaseString componentsSeparatedByString:[NSString stringWithFormat:@", %@ ", @"season"]];
}
if (sa.count <= 1) {
sa = [s.lowercaseString componentsSeparatedByString:[NSString stringWithFormat:@", %@ ", @"book"]];
}