Importing Delicious tags into MarsEdit

MarsEdit

For some time I’ve been wanting to move my blogging efforts over a desktop app, to be able to control multiple blogs from one place, and to search through and manage the content more easily.

The 2 main contenders that I could find for the Mac platform were Ecto and MarsEdit.  The latter seems to be considerably more actively maintained, has a slicker interface and was available for download on the Mac AppStore so I went with that.

The main feature I was missing in MarsEdit was the fairly comprehensive tag handling offered by WordPress.  The fact you can type only a few letters of the tag you need and it auto-completes is something you can’t do without once you get used to it.  The Delicious website and similar desktop tools all offer this functionality.

The first challenge was to get my data out of Delicious, not the links/bookmarks that are offered as their only export option but the actual tags.  Not surprisingly there’s a WP plugin for that, enter EG-Delicious Tags.

Once your tags are copied over to your WP installation you can access the data as a serialized array from the WP database, it’s in the options table under the key _transient_egdel_tags.

Then the data needs to be integrated with MarsEdit.  The app’s author, Daniel Jalkut, kindly explained which plist file within the app needs to be updated to enable the search auto-completion feature.

A simple PHP script was sufficient to deserialize the data and wrap it in XML tags:

<?php
$data = <<<DATA
a:773:{s:7:”_blogit”; …
DATA;
$struct = (unserialize($data));
$keys = array_keys($struct);
$out = ”;
$out .=”\n”;
foreach ($keys as $tag) { $out .=”<string>$tag</string>\n”;}
print $out;
?>

Add the XML to the relevant key and save out the DataSources.plist file and you’re done.