aku-aku: v.. To move a tall, flat bottomed object (such as a bookshelf) by swiveling it alternatively on its corners in a "walking" fashion. [After the book by Thor Heyerdahl theorising the statues of Easter Island were moved in this fashion.] source: LangMaker.com. Aku Aku also has another meaning to the islanders: a spiritual guide.
« Review: Gilda (1946) | Main Page | sights on clement street »
imdb moveabletype hack
Posted by dav at 2003 March 8 05:47 PM
File under: Geek

UPDATE: THIS HACK HAS BEEN REPLACE BY A NEW IMPROVED HACK! SEE IT HERE

That last movie review post I made was the first one using a new system I hacked together to make doing movie review post entries easier in moveable type. The system works like this for the user (me) once it is set up:


  1. Go to the Internet Movie Database web site and find the movie you wish to review. This will be a page with a URL like http://us.imdb.com/Title?0123456789
  2. Now select the Post to Movaeable Type bookmarklet from your bookmarks. (You create the bookmarklet from the Moveable Type main menu when you're logged in).

That's it, when the popup post entry form appears, the title will be pre-filled with the movie title and the text area will be prefilled with HTML that links in the movie image from imdb and a link back to the imdb page.

Setting it up only takes a few minutes and involves two steps:


  1. Download my IMDB perl module and install in your extlib dir on the server (more detailed instructions in the comments at the top of the perl module).
  2. Edit your CMS.pm file like this:

    (apologies to PapaScott for the rip off).

    I suggest making a backup copy of CMS.pm first.

    Somewhere in the neighborhood of line 584 in MT 2.51, or line 623 in MT 2.6 in {your MT directory}/lib/MT/App/CMS.pm, you should find:

    if ($q->param('is_bm')) {
       $param{selected_text} = $param{text};

    and just below that is the section that produces the stuff that will be inserted in your post from the "Post to MT Blog" bookmarklet:

      $param{text} = sprintf qq(<a title="%s"   href="%s">%s</a>\n\n%s),
      scalar $q->param('link_title'),
      scalar $q->param('link_href'),
      scalar $q->param('link_title'),
      $param{text};

    Replace that section with:

    # BEGIN altered by Dav 2003/Mar/08
    if ($q->param('link_href')=~/^http:\/\/[^\.]+\.imdb\.com\/Title\?/) {
      my $imdbURL = scalar $q->param('link_href');
      require Dav::MT::IMDB;
      my $IMDB = Dav::MT::IMDB::parseIMDB($imdbURL);
      #$param{text}=Dav::MT::IMDB::xlateIMDBURLtoHTML($imdbURL);
      $param{title} = "Review: $IMDB->{'title'}";
      my $html = "<a href=\"$imdbURL\"><img src=\"$IMDB->{'imageURL'}\"/>$IMDB->{'title'}</a>\n";
      $param{text} = $html;
    } else {
      $param{selected_text} = $param{text};
      $param{text} = sprintf qq(<a title="%s" href="%s">%s</a>\n\n%s),
      scalar $q->param('link_title'),
      scalar $q->param('link_href'),
      scalar $q->param('link_title'),
      $param{text};
    }
    # END altered by Dav 2003/Mar/08



After installing that module and making that change in the CMS.pm file, simply follow the user steps outlined above.

What it does is this: when the New Post Form is brought up in bookmarklet mode it checks to see if the page URL starts with http://(something).imdb.com/Title?. If it doesn't, it just carries on like usual. But if it does then it uses my perl module to download that web page and parse through it for information like the image URL and the movie title. It then uses that information to pre-fill the text area.

I'll try to clean it up some later when I have more time (and I'd also like to make a similar system for books/music), and make it more flexible (perhaps we can start a movie review aggregator that will automatically be added to the trackback section). In the meantime feel free to use it at your site, but how about sending me a trackback ping or leave a comment here if you do? Thanks.

Comments:

Dav.... I followed your instructions and I am getting this error message when I click on the booklets....

Can't locate Dav/MT/IMDB.pm in @INC (@INC contains: ../lib plugins /usr/share/Blog/extlib /usr/share/Blog/lib /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at /usr/share/Blog/lib/MT/App/CMS.pm line 639.

Any help?

Posted by: Skip Stone on March 18, 2003 03:52 PM

Nevermind I got it to work. Thanks for the plug in....

Posted by: Skip Stone on March 18, 2003 04:07 PM

Just for reference, this is what I sent Skip before I realized he already fixed it (just in case anyone else has similar issue):


The module IMDB.pm needs to be under
/usr/share/Blog/extlib
and in the Dav/MT subdirectory

So it would be like this:

/usr/share/Blog/extlib/Dav/MT/IMDB.pm

you probably need to
mkdir -p /usr/share/Blog/extlib/Dav/MT
cp IMDB.pm /usr/share/Blog/extlib/Dav/MT/

Posted by: Dav on March 18, 2003 05:35 PM

Post a new comment:

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?