[Highly Complete / MIDI] Fix numeric tag reading
The new Core Data interface is especially stringent with receiving NSNumber for the numeric types rather than NSString as was mistakenly allowed before. Fix that to prevent exceptions. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
3eca088cc7
commit
67f6c931bb
|
@ -266,11 +266,12 @@ static int psf_info_meta(void *context, const char *name, const char *value) {
|
|||
[taglc isEqualToString:@"albumartist"] ||
|
||||
[taglc isEqualToString:@"artist"] ||
|
||||
[taglc isEqualToString:@"album"] ||
|
||||
[taglc isEqualToString:@"year"] ||
|
||||
[taglc isEqualToString:@"genre"] ||
|
||||
[taglc isEqualToString:@"genre"]) {
|
||||
[state->info setObject:svalue forKey:taglc];
|
||||
} else if([taglc isEqualToString:@"year"] ||
|
||||
[taglc isEqualToString:@"track"] ||
|
||||
[taglc isEqualToString:@"disc"]) {
|
||||
[state->info setObject:svalue forKey:taglc];
|
||||
[state->info setObject:[NSNumber numberWithInt:[svalue intValue]] forKey:taglc];
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
midi_meta_data_item item;
|
||||
bool remap_display_name = !metadata.get_item("title", item);
|
||||
|
||||
NSArray *allowedKeys = @[@"title", @"artist", @"albumartist", @"album", @"year", @"genre"];
|
||||
NSArray *allowedKeys = @[@"title", @"artist", @"albumartist", @"album", @"genre"];
|
||||
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:10];
|
||||
|
||||
|
@ -72,8 +72,11 @@
|
|||
if(![name isEqualToString:@"type"]) {
|
||||
if(remap_display_name && [name isEqualToString:@"display_name"])
|
||||
name = @"title";
|
||||
if([allowedKeys containsObject:name])
|
||||
if([allowedKeys containsObject:name]) {
|
||||
[dict setObject:guess_encoding_of_string(item.m_value.c_str()) forKey:name];
|
||||
} else if([name isEqualToString:@"year"]) {
|
||||
[dict setObject:[NSNumber numberWithInt:[guess_encoding_of_string(item.m_value.c_str()) intValue]] forKey:name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue