From a17494be658b2c073e6e58d792ffca0915d5067b Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Thu, 9 Oct 2014 14:15:31 +0200 Subject: [PATCH] Load more metadata from the non english iTunes Stores. Patch by Timo Erdmann. --- Classes/MetadataImporters/iTunesStore.m | 9 +++-- iTunesStores.json | 50 ++++++++++++------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Classes/MetadataImporters/iTunesStore.m b/Classes/MetadataImporters/iTunesStore.m index 09233ce..f40578d 100755 --- a/Classes/MetadataImporters/iTunesStore.m +++ b/Classes/MetadataImporters/iTunesStore.m @@ -240,15 +240,16 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context) - (MP42Metadata *) loadMovieMetadata:(MP42Metadata *)aMetadata language:(NSString *)aLanguage { NSData *xmlData = [MetadataImporter downloadDataFromURL:[NSURL URLWithString:[[aMetadata tagsDict] valueForKey:@"iTunes URL"]] withCachePolicy:SBDefaultPolicy]; if (xmlData) { + NSDictionary *store = [iTunesStore getStoreFor:aLanguage]; NSXMLDocument *xml = [[NSXMLDocument alloc] initWithData:xmlData options:NSXMLDocumentTidyHTML error:NULL]; - NSArray *p = [iTunesStore readPeople:@"Actor" fromXML:xml]; + NSArray *p = [iTunesStore readPeople:[store valueForKey:@"actor"] fromXML:xml]; if (p && [p count]) [aMetadata setTag:[p componentsJoinedByString:@", "] forKey:@"Cast"]; - p = [iTunesStore readPeople:@"Director" fromXML:xml]; + p = [iTunesStore readPeople:[store valueForKey:@"director"] fromXML:xml]; if (p && [p count]) [aMetadata setTag:[p componentsJoinedByString:@", "] forKey:@"Director"]; if (p && [p count]) [aMetadata setTag:[p componentsJoinedByString:@", "] forKey:@"Artist"]; - p = [iTunesStore readPeople:@"Producer" fromXML:xml]; + p = [iTunesStore readPeople:[store valueForKey:@"producer"] fromXML:xml]; if (p && [p count]) [aMetadata setTag:[p componentsJoinedByString:@", "] forKey:@"Producers"]; - p = [iTunesStore readPeople:@"Screenwriter" fromXML:xml]; + p = [iTunesStore readPeople:[store valueForKey:@"screenwriter"] fromXML:xml]; if (p && [p count]) [aMetadata setTag:[p componentsJoinedByString:@", "] forKey:@"Screenwriters"]; NSArray *nodes = [xml nodesForXPath:[NSString stringWithFormat:@"//li[@class='copyright']"] error:NULL]; for (NSXMLNode *n in nodes) { diff --git a/iTunesStores.json b/iTunesStores.json index b6caf31..03d4f82 100755 --- a/iTunesStores.json +++ b/iTunesStores.json @@ -1,27 +1,27 @@ [ - {"storeCode": 143441, "country3": "USA", "country2": "US", "language2": "EN", "language": "English", "season": "season", "country": "USA"}, - {"storeCode": 143460, "country3": "AUS", "country2": "AU", "language2": "EN", "language": "English", "season": "season", "country": "Australia"}, - {"storeCode": 143446, "country3": "BEL", "country2": "BE", "language2": "NL", "language": "Nederlands", "season": "", "country": "België"}, - {"storeCode": 143446, "country3": "BEL", "country2": "BE", "language2": "FR", "language": "Français", "season": "saison", "country": "Belgique"}, - {"storeCode": 143503, "country3": "BRA", "country2": "BR", "language2": "PT", "language": "Português", "season": "", "country": "Brasil"}, - {"storeCode": 143455, "country3": "CAN", "country2": "CA", "language2": "EN", "language": "English", "season": "season", "country": "Canada"}, - {"storeCode": 143455, "country3": "CAN", "country2": "CA", "language2": "FR", "language": "Français", "season": "saison", "country": "Canada"}, - {"storeCode": 143458, "country3": "DNK", "country2": "DK", "language2": "DA", "language": "Dansk", "season": "", "country": "Danmark"}, - {"storeCode": 143443, "country3": "DEU", "country2": "DE", "language2": "DE", "language": "Deutsch", "season": "staffel", "country": "Deutschland"}, - {"storeCode": 143454, "country3": "ESP", "country2": "ES", "language2": "ES", "language": "Español", "season": "", "country": "España"}, - {"storeCode": 143442, "country3": "FRA", "country2": "FR", "language2": "FR", "language": "Français", "season": "saison", "country": "France"}, - {"storeCode": 143448, "country3": "GRC", "country2": "GR", "language2": "HE", "language": "ελληνικά", "season": "", "country": "Greece"}, - {"storeCode": 143449, "country3": "IRL", "country2": "IE", "language2": "EN", "language": "English", "season": "season", "country": "Ireland"}, - {"storeCode": 143450, "country3": "ITA", "country2": "IT", "language2": "IT", "language": "Italiano", "season": "", "country": "Italia"}, - {"storeCode": 143462, "country3": "JPN", "country2": "JP", "language2": "JA", "language": "日本語", "season": "", "country": "日本"}, - {"storeCode": 143451, "country3": "LUX", "country2": "LU", "language2": "FR", "language": "Français", "season": "saison", "country": "Luxembourg"}, - {"storeCode": 143452, "country3": "NLD", "country2": "NL", "language2": "NL", "language": "Nederlands", "season": "", "country": "Nederland"}, - {"storeCode": 143461, "country3": "NZL", "country2": "NZ", "language2": "EN", "language": "English", "season": "season", "country": "New Zealand"}, - {"storeCode": 143457, "country3": "NOR", "country2": "NO", "language2": "NO", "language": "Norsk", "season": "", "country": "Norge"}, - {"storeCode": 143453, "country3": "PRT", "country2": "PT", "language2": "PT", "language": "Português", "season": "", "country": "Portugal"}, - {"storeCode": 143459, "country3": "CHE", "country2": "CH", "language2": "DE", "language": "Deutsch", "season": "staffel", "country": "Schweiz"}, - {"storeCode": 143459, "country3": "CHE", "country2": "CH", "language2": "FR", "language": "Français", "season": "saison", "country": "Suisse"}, - {"storeCode": 143447, "country3": "FIN", "country2": "FI", "language2": "FI", "language": "Suomi", "season": "", "country": "Suomi"}, - {"storeCode": 143456, "country3": "SWE", "country2": "SE", "language2": "SV", "language": "Svenska", "season": "", "country": "Sverige"}, - {"storeCode": 143444, "country3": "GBR", "country2": "GB", "language2": "EN", "language": "English", "season": "season", "country": "UK"} + {"storeCode": 143441, "country3": "USA", "country2": "US", "language2": "EN", "language": "English", "season": "season", "country": "USA", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143460, "country3": "AUS", "country2": "AU", "language2": "EN", "language": "English", "season": "season", "country": "Australia", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143446, "country3": "BEL", "country2": "BE", "language2": "NL", "language": "Nederlands", "season": "", "country": "België", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143446, "country3": "BEL", "country2": "BE", "language2": "FR", "language": "Français", "season": "saison", "country": "Belgique", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143503, "country3": "BRA", "country2": "BR", "language2": "PT", "language": "Português", "season": "", "country": "Brasil", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143455, "country3": "CAN", "country2": "CA", "language2": "EN", "language": "English", "season": "season", "country": "Canada", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143455, "country3": "CAN", "country2": "CA", "language2": "FR", "language": "Français", "season": "saison", "country": "Canada", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143458, "country3": "DNK", "country2": "DK", "language2": "DA", "language": "Dansk", "season": "", "country": "Danmark", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143443, "country3": "DEU", "country2": "DE", "language2": "DE", "language": "Deutsch", "season": "staffel", "country": "Deutschland", "actor": "Schauspieler", "director": "Regisseur", "producer": "Produzent", "screenwriter": "Drehbuchautoren"}, + {"storeCode": 143454, "country3": "ESP", "country2": "ES", "language2": "ES", "language": "Español", "season": "", "country": "España", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143442, "country3": "FRA", "country2": "FR", "language2": "FR", "language": "Français", "season": "saison", "country": "France", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143448, "country3": "GRC", "country2": "GR", "language2": "HE", "language": "ελληνικά", "season": "", "country": "Greece", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143449, "country3": "IRL", "country2": "IE", "language2": "EN", "language": "English", "season": "season", "country": "Ireland", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143450, "country3": "ITA", "country2": "IT", "language2": "IT", "language": "Italiano", "season": "", "country": "Italia", "actor": "Attori", "director": "Regista", "producer": "Produttori", "screenwriter": "Sceneggiatori"}, + {"storeCode": 143462, "country3": "JPN", "country2": "JP", "language2": "JA", "language": "日本語", "season": "", "country": "日本", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143451, "country3": "LUX", "country2": "LU", "language2": "FR", "language": "Français", "season": "saison", "country": "Luxembourg", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143452, "country3": "NLD", "country2": "NL", "language2": "NL", "language": "Nederlands", "season": "", "country": "Nederland", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143461, "country3": "NZL", "country2": "NZ", "language2": "EN", "language": "English", "season": "season", "country": "New Zealand", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143457, "country3": "NOR", "country2": "NO", "language2": "NO", "language": "Norsk", "season": "", "country": "Norge", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143453, "country3": "PRT", "country2": "PT", "language2": "PT", "language": "Português", "season": "", "country": "Portugal", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143459, "country3": "CHE", "country2": "CH", "language2": "DE", "language": "Deutsch", "season": "staffel", "country": "Schweiz", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143459, "country3": "CHE", "country2": "CH", "language2": "FR", "language": "Français", "season": "saison", "country": "Suisse", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143447, "country3": "FIN", "country2": "FI", "language2": "FI", "language": "Suomi", "season": "", "country": "Suomi", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143456, "country3": "SWE", "country2": "SE", "language2": "SV", "language": "Svenska", "season": "", "country": "Sverige", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"}, + {"storeCode": 143444, "country3": "GBR", "country2": "GB", "language2": "EN", "language": "English", "season": "season", "country": "UK", "actor": "Actor", "director": "Director", "producer": "Producer", "screenwriter": "Screenwriter"} ] \ No newline at end of file