Re: MDItemCopyAttributes replacement for audio
Re: MDItemCopyAttributes replacement for audio
- Subject: Re: MDItemCopyAttributes replacement for audio
- From: Kyle Sluder <email@hidden>
- Date: Tue, 05 Nov 2013 22:54:02 -0800
On Tue, Nov 5, 2013, at 10:29 PM, Gerriet M. Denkmann wrote:
>
> id aikey = ai.key; // is NSNumber - not documented
> OSType hfsFileTypeCode = [ aikey unsignedIntValue ];
> NSString *ke1 = NSFileTypeForHFSTypeCode ( hfsFileTypeCode ); //
> not documented either
> But this gives ke1 = '©nam', not quite the same as
> AVMetadataiTunesMetadataKeySongName which is "@nam".
>
> Without some function like: isEqual( key,
> AVMetadataiTunesMetadataKeySongName ) this property seems to be quite
> useless.
Use commonKey. That will correctly handle attributes from all file
formats (iTunes, MP3, etc.) which have definde mappings back to the
common key space.
AVAsset *asset = [AVAsset assetWithURL:[NSURL
fileURLWithPath:@"/Users/kyle/Music/iTunes/iTunes
Music/Music/Jawbox/For Your Own Special Sweetheart/02 Savory.m4a"]];
NSArray *metadata = [AVMetadataItem
metadataItemsFromArray:asset.commonMetadata
withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
NSLog(@"%@", [metadata[0] stringValue]);
// "Savory"
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden