Cuesheet: Read and merge metadata from referenced audio files, no matter their format
This commit is contained in:
parent
63e10bcb77
commit
5772662984
5 changed files with 61 additions and 13 deletions
|
@ -142,6 +142,7 @@
|
|||
838F851E256B4E5E00C3E614 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 838F851D256B4E5E00C3E614 /* Sparkle.framework */; };
|
||||
838F851F256B4E8B00C3E614 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 838F851D256B4E5E00C3E614 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
8399D4E21805A55000B503B1 /* XmlContainer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8399D4E01805A55000B503B1 /* XmlContainer.m */; };
|
||||
839DA7CF274A2D4C001B18E5 /* NSDictionary+Merge.m in Sources */ = {isa = PBXBuildFile; fileRef = 839DA7CE274A2D4C001B18E5 /* NSDictionary+Merge.m */; };
|
||||
83A360B220E4E81D00192DAB /* Flac.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8303A30C20E4E3D000951EF8 /* Flac.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
83B06704180D579E008E3612 /* MIDI.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83B066A1180D5669008E3612 /* MIDI.bundle */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
83BC5AB220E4C87100631CD4 /* DualWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 83BC5AB020E4C87100631CD4 /* DualWindow.m */; };
|
||||
|
@ -875,6 +876,8 @@
|
|||
838F851D256B4E5E00C3E614 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = ThirdParty/Frameworks/Sparkle.framework; sourceTree = "<group>"; };
|
||||
8399D4E01805A55000B503B1 /* XmlContainer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XmlContainer.m; sourceTree = "<group>"; };
|
||||
8399D4E11805A55000B503B1 /* XmlContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlContainer.h; sourceTree = "<group>"; };
|
||||
839DA7CB274A2D4C001B18E5 /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Merge.h"; sourceTree = "<group>"; };
|
||||
839DA7CE274A2D4C001B18E5 /* NSDictionary+Merge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Merge.m"; sourceTree = "<group>"; };
|
||||
83AB9031237CEFD300A433D5 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
|
||||
83B0669C180D5668008E3612 /* MIDI.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = MIDI.xcodeproj; path = Plugins/MIDI/MIDI.xcodeproj; sourceTree = "<group>"; };
|
||||
83BC5AB020E4C87100631CD4 /* DualWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DualWindow.m; path = Window/DualWindow.m; sourceTree = "<group>"; };
|
||||
|
@ -1058,24 +1061,26 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
8384912518080F2D00E7332D /* Logging.h */,
|
||||
177EC01A0B8BC2CF0000BC8C /* TrackingCell.h */,
|
||||
177EC01B0B8BC2CF0000BC8C /* TrackingCell.m */,
|
||||
177EC01C0B8BC2CF0000BC8C /* TrackingSlider.h */,
|
||||
177EC01D0B8BC2CF0000BC8C /* TrackingSlider.m */,
|
||||
178456100F631E31007E8021 /* SideViewController.h */,
|
||||
178456110F631E31007E8021 /* SideViewController.m */,
|
||||
07E18DF10D62B38400BB0E11 /* NSArray+ShuffleUtils.h */,
|
||||
07E18DF20D62B38400BB0E11 /* NSArray+ShuffleUtils.m */,
|
||||
8355D6B4180612F300D05687 /* NSData+MD5.h */,
|
||||
8355D6B5180612F300D05687 /* NSData+MD5.m */,
|
||||
839DA7CB274A2D4C001B18E5 /* NSDictionary+Merge.h */,
|
||||
839DA7CE274A2D4C001B18E5 /* NSDictionary+Merge.m */,
|
||||
8E9A30130BA792DC0091081B /* NSFileHandle+CreateFile.h */,
|
||||
8E9A30140BA792DC0091081B /* NSFileHandle+CreateFile.m */,
|
||||
172A12A70F59AF8A0078EF0C /* NSString+CogSort.h */,
|
||||
172A12A80F59AF8A0078EF0C /* NSString+CogSort.m */,
|
||||
F6F9671A102C70C800D2C9B4 /* NSString+FinderCompare.h */,
|
||||
F6F96718102C709000D2C9B4 /* NSString+FinderCompare.m */,
|
||||
8E9A30130BA792DC0091081B /* NSFileHandle+CreateFile.h */,
|
||||
8E9A30140BA792DC0091081B /* NSFileHandle+CreateFile.m */,
|
||||
07E18DF10D62B38400BB0E11 /* NSArray+ShuffleUtils.h */,
|
||||
07E18DF20D62B38400BB0E11 /* NSArray+ShuffleUtils.m */,
|
||||
178456100F631E31007E8021 /* SideViewController.h */,
|
||||
178456110F631E31007E8021 /* SideViewController.m */,
|
||||
17FAEBAA0F662985007C8707 /* ToolTipTextField.h */,
|
||||
17FAEBAB0F662985007C8707 /* ToolTipTextField.m */,
|
||||
8355D6B4180612F300D05687 /* NSData+MD5.h */,
|
||||
8355D6B5180612F300D05687 /* NSData+MD5.m */,
|
||||
177EC01A0B8BC2CF0000BC8C /* TrackingCell.h */,
|
||||
177EC01B0B8BC2CF0000BC8C /* TrackingCell.m */,
|
||||
177EC01C0B8BC2CF0000BC8C /* TrackingSlider.h */,
|
||||
177EC01D0B8BC2CF0000BC8C /* TrackingSlider.m */,
|
||||
);
|
||||
path = Utils;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2225,6 +2230,7 @@
|
|||
17249F0F0D82E17700F33392 /* ToggleQueueTitleTransformer.m in Sources */,
|
||||
179D031E0E0CB2500064A77A /* ContainedNode.m in Sources */,
|
||||
179D031F0E0CB2500064A77A /* ContainerNode.m in Sources */,
|
||||
839DA7CF274A2D4C001B18E5 /* NSDictionary+Merge.m in Sources */,
|
||||
179D03200E0CB2500064A77A /* DirectoryNode.m in Sources */,
|
||||
179D03210E0CB2500064A77A /* FileIconCell.m in Sources */,
|
||||
179D03220E0CB2500064A77A /* FileNode.m in Sources */,
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
833F68371CDBCAB200AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
835C888E22CC1883001B4B3F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
8384912A180814D900E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = "<group>"; };
|
||||
839DA7D0274A2EA9001B18E5 /* AudioMetadataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioMetadataReader.h; path = ../../Audio/AudioMetadataReader.h; sourceTree = "<group>"; };
|
||||
839DA7D3274A2FD4001B18E5 /* NSDictionary+Merge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSDictionary+Merge.h"; path = "../../Utils/NSDictionary+Merge.h"; sourceTree = "<group>"; };
|
||||
8D5B49B6048680CD000E48DA /* CueSheet.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CueSheet.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8E8D42240CBB0F5800135C1B /* CueSheetContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CueSheetContainer.h; sourceTree = "<group>"; };
|
||||
|
@ -85,6 +87,8 @@
|
|||
08FB77AFFE84173DC02AAC07 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
839DA7D3274A2FD4001B18E5 /* NSDictionary+Merge.h */,
|
||||
839DA7D0274A2EA9001B18E5 /* AudioMetadataReader.h */,
|
||||
8384912A180814D900E7332D /* Logging.h */,
|
||||
8E8D423C0CBB0FF600135C1B /* Plugin.h */,
|
||||
8E8D42240CBB0F5800135C1B /* CueSheetContainer.h */,
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#import "CueSheet.h"
|
||||
#import "CueSheetTrack.h"
|
||||
|
||||
#import "AudioMetadataReader.h"
|
||||
#import "NSDictionary+Merge.h"
|
||||
|
||||
@implementation CueSheetMetadataReader
|
||||
|
||||
+ (NSArray *)fileTypes
|
||||
|
@ -42,7 +45,9 @@
|
|||
{
|
||||
if ([[url fragment] isEqualToString:[track track]])
|
||||
{
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
// Class supplied by CogAudio, which is guaranteed to be present
|
||||
NSDictionary * fileMetadata = [NSClassFromString(@"AudioMetadataReader") metadataForURL:[track url]];
|
||||
NSDictionary * cuesheetMetadata = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[track artist], @"artist",
|
||||
[track album], @"album",
|
||||
[track title], @"title",
|
||||
|
@ -51,6 +56,7 @@
|
|||
[NSNumber numberWithInt:[[track year] intValue]], @"year",
|
||||
nil];
|
||||
|
||||
return [fileMetadata dictionaryByMergingWith:cuesheetMetadata];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
Utils/NSDictionary+Merge.h
Normal file
8
Utils/NSDictionary+Merge.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSDictionary (Merge)
|
||||
|
||||
+ (NSDictionary *) dictionaryByMerging: (NSDictionary *) dict1 with: (NSDictionary *) dict2;
|
||||
- (NSDictionary *) dictionaryByMergingWith: (NSDictionary *) dict;
|
||||
|
||||
@end
|
24
Utils/NSDictionary+Merge.m
Normal file
24
Utils/NSDictionary+Merge.m
Normal file
|
@ -0,0 +1,24 @@
|
|||
#import "NSDictionary+Merge.h"
|
||||
|
||||
@implementation NSDictionary (Merge)
|
||||
|
||||
+ (NSDictionary *) dictionaryByMerging: (NSDictionary *) dict1 with: (NSDictionary *) dict2 {
|
||||
NSMutableDictionary * result = [dict1 mutableCopy];
|
||||
|
||||
[dict2 enumerateKeysAndObjectsUsingBlock: ^(id key, id obj, BOOL *stop) {
|
||||
if (![dict1 objectForKey:key]) {
|
||||
[result setObject: obj forKey: key];
|
||||
} else if ([obj isKindOfClass:[NSDictionary class]]) {
|
||||
NSDictionary * newVal = [[dict1 objectForKey: key] dictionaryByMergingWith: (NSDictionary *) obj];
|
||||
[result setObject: newVal forKey: key];
|
||||
}
|
||||
}];
|
||||
|
||||
return (NSDictionary *) [NSDictionary dictionaryWithDictionary: result];
|
||||
}
|
||||
|
||||
- (NSDictionary *) dictionaryByMergingWith: (NSDictionary *) dict {
|
||||
return [[self class] dictionaryByMerging: self with: dict];
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in a new issue