on 1/7/11 6:19 AM, Alastair Houghton at alast...@alastairs-place.net wrote:
> On 6 Jan 2011, at 20:54, Abhinav Tyagi wrote: > >> 1) I need an efficient approach to solve this problem using Cocoa or C++. >> (very Important) >> 2) How will check a file if its a valid media file or data file. Like we can >> have ".dat" files that are video files but data files can also have ".dat" >> extension. not much >> significant. Is there api that can tell whether a file is media file or not? >> (not soooo >> important). > > Why not use NSMetadataQuery to get Spotlight to search for you? If you search > for Technical Note TN2192 in the documentation, you'll find some sample code. > The Spotlight Overview and Spotlight Query Programming Guide look useful too. I was about to suggest the same thing, using the Metadata.framework (Spotlight). It's going to generally be the fastest and most robust way to accomplish this. The main limitation is Spotlight can only return data that it knows about. So if it's not indexed, you'll never know about that. How much does this matter? Depends upon the OP's design constraints. If he needs to absolutely know every media file on the computer no matter what and where they are, you just have to manually scan the filesystem and use some sort of heuristics to determine "is this a media file, and if so what kind" (QuickTime can help with this, somewhat). -- John C. Daub }:-)>= <mailto:h...@hsoi.com> <http://www.hsoi.com/hsoi/blog/> "A pessimist is one who makes difficulties of his opportunities and an optimist is one who makes opportunities of his difficulties." --Harry Truman _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com