HOWTO: Add comics from comics.org to Delicious Library

With Delicious Library 2 releasing sometime this holiday season, I may actually start using it for my library catalog. What has stopped me in the past was its lack of expandability - with no AppleScript support, I couldn't add in new data scraping functionality myself (though, if I were truly bothered, I'd've done custom imports). Thankfully, Delicious Library 2 fully supports AppleScript and I'm hoping I'll be able to hook into new item creation, as I'd love to store my comic and magazine collections (and maybe even weirder things like collectible card games, but that'd be ReAaALly stretchin' it).

With the prospect of doing comic importing "the right way" (meaning "type in a title and have it Work" vs. "prepare an external file for importing"), I decided to see if I could get the current release, version 1.6.6, doing "the right thing" the wrong way - getting it to Work via an amalgamation of hacks. I succeeded, but I'm not going to spend a lot of time walking through this: I'll assume you're willing to wait until version 2 is out and this all gets rewritten properly (hopefully... if it's not possible, this hack will be fleshed out in more quality-assured detail).

To get this going, you're going to need:

  • The ability to modify the normally hidden /etc/hosts file.
  • The built-in Apache web server enabled (via System Preferences > Sharing).
  • Leopard. There's a 99% chance it'll work on Tiger too, but I'm not checking.
  • The comic book ID you'd like to import from the Grand Comic Database.

Be forewarned: this is a hack in the earliest stages! I'm sure there are plenty of things that can go wrong (like DL loading up the wrong URL for grey arrow clicks, bad scrapes from GCD due to unexpected formatting, the ability to add in other "matching" items from other Amazon sites, release dates that expect the exact day, etc.). I'm hoping all this stuff can be cleaned up a bit more in DL2, but DL is pretty tightly tied to Amazon's Web Services, so pulling data from other sources may always be kludgey like this.

Step 1: Intercept Delicious Library Lookups

The first thing we're going to do is tell Delicious Library to use Amazon Japan for data lookups (in Library > Preferences > Load Details From). I chose the Japan site because I don't think I'll ever legitimately visit there (much less use its Web Services), and the first step of the hack involves redirecting all requests sent to that site from your computer back to your computer. This will trick Delicious Library into thinking it's communicating with Amazon Japan, but instead, it'll be communicating with a script we'll install down in step 2.

To redirect all our Amazon Japan traffic, you'll need to edit /etc/hosts with an authenticating text editor (like BBEdit, or sudo vi, or whatever). Add the following to the bottom of the file, making sure that the whitespace between the two columns is created with a tab:

  127.0.0.1       webservices.amazon.co.jp

Once you save the file, you should be able to access http://webservices.amazon.co.jp/ within your web browser and see that it is most definitely not the Amazon site - it should be whatever page you would normally see if you loaded http://127.0.0.1/ (by default, Apache's "Seeing this instead of the website you expected?").

Step 2: Responding to Delicious Library Lookups

Next, we have to install our script to respond to these lookups. If you attempted to add an item to your Library now, you'll notice that it should still work - it appears DL will default to Amazon US if there are no relevant results on your selected site (Japan, now being redirected back to your computer). The first step to responding correctly is creating a new directory at /Library/WebServer/Documents/onca/. Within this directory, we're going to create a text file called xml which will contain our custom script for loading comic books. This path mimicks the Amazon Web Services lookup that DL requests.

The new file will need to be set to 755 (chmod 755 /Library/WebServer/Documents/onca/xml) so that it is executable. We'll also tell Apache to let this script be executable from the web; to do so, add the following to /etc/apache2/users/username.conf and then restart the web server with sudo apachectl restart:

ScriptAlias /onca/ /Library/WebServer/Documents/onca/
Neat trick? Want me to keep going and get it working in DL2? Send me a buck or two!

Comics.org will be our comic book data source. We'll return data only if we actually find a comic book on that site... otherwise, we'll return nothing, which will force Delicious Library to use Amazon US for your regular scanning needs. Replace your xml file with this final version (renamed to xml), then run through the steps below:

  • Find your comic on the Grand Comic Database.
  • Get the comic ID from the URL (such as 13825 for Batman #111).
  • Add a new item to DL, and add the comic ID to the "Find by #" field.
  • Preface the comic ID with "B0" and then a series of "x"s until it turns into "Find by ASIN".
  • For Batman #111 (13825), you'd use B0xxx13825.
  • Click the "Find by ASIN" button.

If everything works, you should see something like:

Delicious Library importing from comics.org

There's plenty more to be done; I just hope I can do it better in DL2.

Tags:

AttachmentSize
dl_comics-1.0.jpg128 KB

Comments

While you wait for DL 2, why not give Bookpedia a try - all the Pedias have a plug-in architecture so you can write plug-ins to pretty much any site.

Nora - thanks for the recommendation. Unfortunately, I'm a Linux-y/web programmer - I rarely get into Cocoa (or any OS X-specific) coding. My knowledge of AppleScript is pretty much "woohoo, use runShellScript to get to Perl!". I install Apple's Developer Tools to get all the Unix-y things, then promptly delete /Developer. So, whilst I appreciate the pointer to the plugin docs, it's not something I have time to learn (nor desire). Also, what I do like about DL is that it's a generic database - I'd hate to run three different applications for DVDs, Games, and Books, then find myself in a quandary about just which app I'd use to bootstrap my Wine collection (note: I don't have a Wine collection. It's a bad example.)

a pretty good step by step tutorial for "dummies" (like me :) i can only recommend this for everybody which like to add their comics to del.icio.us. well done - thank you!

I wonder what the max number of comicbooks can be or how they can be added/organized within Delicious... the delicious-monster.com website has been down all evening. Bookpedia sounds interesting, going to try Deep Prose software as well... just wish i could export nicely into this new software from BookBin from Spinfree (which went to a service model then died...)

I would suggest taking a look at Booxter 2.0 which will keep track of your books, music, movies, and comic books. It works directly with comics.org (no need for any of the above sort of workarounds) and does a great job of cataloging comics.

Booxter has been around for many years, has recently been updated with a lot of powerful features, and is available right now. It can also import from Delicious Library, so if you are a current Delicious Library user, you can download Booxter and try it out.

Any luck on getting a script to run with Delicious Library 2?

I haven't bothered developing it. I couldn't get past the horrific horizontal details pane. I no longer use DL.

is this working now? i wanna catalog my comics but i want that to work before i purchase delicious library :)

hi there

I have a problem with too long category names in delicious library. see:
https://getsatisfaction.com/deliciousmonster/topics/different_questions_...

Is there a hack on this?

Thanks for replying.

cheers.

Add new comment