Tuesday, February 2, 2010

QuickLook and Ogg

UPDATE: Wow, I can't believe I made this mistake! There should've been a line *before* the first <array>. It's fixed now (it only took me a while :/)
I just stumbled into yet another roadblock to the free software alternative to MP3, Ogg: QuickLook fails to preview ogg vorbis files.  I knew QuickTime would play Ogg Vorbis after installing the XiphQT component so I installed that.  Still, no QuickLook previews for Ogg Vorbis.  I now had a mission.

I started with a google search for quicklook and ogg, nobody seems to have written a QL plugin for ogg yet.  I ran across a few blog posts about adding text types to TextEdit so that they could be previewed by QL and thought to myself: can this be extended to QuickTime?  One short patch to QuickTime's Info.plist later and I found out that it could!!

Append the following above the last 2 lines of your QuickTime's Info.plist (the last 2 lines are </dict> followed by </plist>), save it, then move QuickTime out of your Applications folder and into a folder *not* in the Applications folder hierarchy, then move it back. Problem solved!
<key>UTExportedTypeDeclarations</key>
<array>
 <dict>
  <key>UTTypeConformsTo</key>
  <array>
   <string>com.apple.quicktime-movie</string>
  </array>
  <key>UTTypeDescription</key>
  <string>OGG Audio/Video file</string>
  <key>UTTypeIdentifier</key>
  <string>org.xiph.ogg</string>
  <key>UTTypeTagSpecification</key>
  <dict>
   <key>com.apple.ostype</key>
   <string></string>
   <key>public.filename-extension</key>
   <array>
    <string>ogg</string>
   </array>
  </dict>
 </dict>
</array>