Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need to open files in a format which has no predefined UTI, but I don't own the format. How should I export the UTI?

The general question: when I don't own a particular file format, but no UTI has been defined for it by someone else, how do I use that file format?

The specific situation: I'm creating a QuickLook plugin for .torrent and .nzb files. (Note: .nzb files are similar to .torrent files, except instead of pointing to a bittorrent tracker, they point to a Usenet server.) I want the plugin to display what data the .nzb/.torrent file points to, what files would be downloaded if they were opened, and any other applicable metadata. To do this, I have to set forth the Uniform Type Identifiers for these two filetypes. While .torrent files have a designated UTI of com.bittorrent.torrent, .nzb files do not - the NZB format is defined by newzbin.com, which doesn't publish its own application (and therefore doesn't define a Mac OS X Uniform Type Identifier for me to use).

The options seem to be:

  1. Export and use a UTI in the form of com.example.nzb, where example.com is owned by me. This seems wrong, because I don't own the nzb format.
  2. Export and use a UTI in the form of com.newzbin.nzb, where newzbin.com is not owned by me. This seems wrong, because I don't own newzbin.com.
  3. Do as e.g. Unison (a Mac OS X application) does and ignore UTI entirely, and use CFBundleTypeExtensions in my Info.plist file. This seems wrong too, because not only is CFBundleTypeExtensions deprecated per Apple's documentation, but I don't think I can mix use of CFBundleTypeExtensions and LSBundleContentTypes (if LSBundleContentTypes is present, as it must be for me to use the com.bittorrent.torrent UTI, then CFBundleTypeExtensions is ignored).

What's the right thing to do in this situation?

like image 887
Micah R Ledbetter Avatar asked Sep 13 '11 22:09

Micah R Ledbetter


1 Answers

Try using the mdls command line utility to find a .nzb file's UTI.

For example performing mdls on this QuickTime movie clearly shows its UTI, boxed in red below. mdls

like image 96
spudwaffle Avatar answered Oct 25 '22 00:10

spudwaffle