Archive for March 11th, 2007

Spotlight CHM Metadata Importer

Sunday, March 11th, 2007

Here is a Spotlight CHM (HTML Help, Compressed HTML) Metadata Importer that I wrote. It is written in python using chmlib and PyCHM. It takes each html page in the chm file, converts it to plain text, and applies that text to the kMDItemTextContent Spotlight attribute of the file.

Install Instructions:

]$ wget http://www.mattweber.org/files/chm-metadata-importer.tar.bz2
]$ bzip2 -d chm-metadata-importer.tar.bz2
]$ tar -xvf chm-metadata-importer.tar
]$ sudo mv CHM\ Metadata\ Importer.mdimporter/ /Library/Spotlight/

This plugin has only been tested on Intel Macs. Please make sure you have Python 2.5 installed before using this plugin.

Note:
I have been informed of a problem with the importer. It seems that CHMLib did not get packaged correctly and is failing on some systems. I have not had the time to figure out how to correctly package a library with xcode yet, but I have found a quick fix.

  1. Download CHMLib from http://www.jedrea.com/chmlib/
  2. Extract, and change into the chmlib directory.
  3. Run ./configure; make; sudo make install

Now the importer should run correctly. You can test it by typing:

mdimport -nfd4 file-to-import.chm

Files:
http://www.mattweber.org/files/chm-metadata-importer.tar.bz2
http://www.mattweber.org/files/chm-metadata-importer-source.tar.bz2