Reputation: 64834
What's the easiest way to:
with Cocoa ?
I currently have the file path only.
Thanks
Upvotes: 1
Views: 589
Reputation: 22930
For metadata you can use MDItem.
MDItem is a CF-compliant object that represents a file and the metadata associated with the file.
MDItemRef metadata = MDItemCreate(NULL, (CFStringRef)@"/Users/parag/0.mp3");
NSNumber *audioBitrate = (NSNumber *)MDItemCopyAttribute(metadata, kMDItemAudioBitRate);
NSLog(@"audioBitrate:%i", [audioBitrate intValue]);
For file size
[[[NSFileManager defaultManager] attributesOfItemAtPath:@"/Users/parag/0.mp3" error:nil] fileSize];
play the mp3 on iTunes
NSString *cmd = @"open -a /Applications/iTunes.app '/Users/parag/0.mp3'";
system([cmd UTF8String]);
Upvotes: 1