Metadata loading: Correctly merge over empty tags
Metadata versus properties merging, correctly merge over empty fields if they are assigned with empty strings or zeroed numbers, instead of only merging over completely missing fields. Fixes emailed bug, CUE Sheet metadata reading, primarily. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
67fcd2bb27
commit
b8a98e301e
|
@ -13,6 +13,8 @@
|
|||
#import "OutputNode.h"
|
||||
#import "Plugin.h"
|
||||
|
||||
#import "NSDictionary+Merge.h"
|
||||
|
||||
#import "Logging.h"
|
||||
|
||||
@implementation InputNode
|
||||
|
@ -116,18 +118,13 @@
|
|||
nodeLossless = [[properties valueForKey:@"encoding"] isEqualToString:@"lossless"];
|
||||
} else if([keyPath isEqual:@"metadata"]) {
|
||||
// Inform something of metadata change
|
||||
NSMutableDictionary *entryInfo = [NSMutableDictionary dictionaryWithCapacity:32];
|
||||
|
||||
NSDictionary *entryProperties = [decoder properties];
|
||||
if(entryProperties == nil)
|
||||
return;
|
||||
|
||||
[entryInfo addEntriesFromDictionary:[decoder metadata]];
|
||||
[entryInfo addEntriesFromDictionary:entryProperties];
|
||||
NSDictionary *entryInfo = [NSDictionary dictionaryByMerging:entryProperties with:[decoder metadata]];
|
||||
|
||||
NSDictionary * info = [NSDictionary dictionaryWithDictionary:entryInfo];
|
||||
|
||||
[controller pushInfo:info];
|
||||
[controller pushInfo:entryInfo];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
#import "Logging.h"
|
||||
|
||||
#import "NSDictionary+Merge.h"
|
||||
|
||||
@implementation PlaylistLoader
|
||||
|
||||
- (id)init {
|
||||
|
@ -555,18 +557,13 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
|
||||
DLog(@"Loading metadata for %@", weakPe.URL);
|
||||
|
||||
NSMutableDictionary *entryInfo = [NSMutableDictionary dictionaryWithCapacity:32];
|
||||
|
||||
NSDictionary *entryProperties = [AudioPropertiesReader propertiesForURL:weakPe.URL];
|
||||
if(entryProperties == nil)
|
||||
return;
|
||||
|
||||
NSDictionary *entryMetadata = [AudioMetadataReader metadataForURL:weakPe.URL];
|
||||
|
||||
if(entryMetadata)
|
||||
[entryInfo addEntriesFromDictionary:entryMetadata];
|
||||
|
||||
[entryInfo addEntriesFromDictionary:entryProperties];
|
||||
NSDictionary *entryInfo = [NSDictionary dictionaryByMerging:entryProperties with:entryMetadata];
|
||||
|
||||
[weakLock lock];
|
||||
[weakArray addObject:weakPe];
|
||||
|
@ -639,14 +636,11 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
|
||||
DLog(@"Loading metadata for %@", pe.URL);
|
||||
|
||||
NSMutableDictionary *entryInfo = [NSMutableDictionary dictionaryWithCapacity:32];
|
||||
|
||||
NSDictionary *entryProperties = [AudioPropertiesReader propertiesForURL:pe.URL];
|
||||
if(entryProperties == nil)
|
||||
return;
|
||||
|
||||
[entryInfo addEntriesFromDictionary:[AudioMetadataReader metadataForURL:pe.URL]];
|
||||
[entryInfo addEntriesFromDictionary:entryProperties];
|
||||
NSDictionary *entryInfo = [NSDictionary dictionaryByMerging:entryProperties with:[AudioMetadataReader metadataForURL:pe.URL]];
|
||||
|
||||
[pe setMetadata:entryInfo];
|
||||
[store trackUpdate:pe];
|
||||
|
|
Loading…
Reference in New Issue