Zorac (zorac) wrote,
Zorac
zorac

  • Mood:
  • Music:

The GIPppiest GIP that ever was GIPped!

See my new icon? That's today’s Dilbert strip - whatever day you're reading this (except Sundays at the moment). Nifty, huh? I have a bunch of perl which grabs the latest strip from the Dilbert website, cuts it up, resizes the parts to make an animated GIF then uploads it to LJ in place of the existing one.

The first part is grabbing the strip - slightly non-trivial as they stick a random number in the image name for exactly that purpose, but I did this years ago to grab the latest Dilbert and User Friendly for the company intranet each day.

Creating the icon was surprisingly straightforward using ImageMagick - a bit of manual inspection to figure out where the box boundaries are, then coding up a few simple crop and resize operations, and the save out as an animation works automagickally.

By far the hardest part was doing the upload, involving a whole bunch of HTTP requests:

  1. Hit the login page with the username and password to get session cookies.
  2. Grab the current edit pics page, saving all the existing icon names and which one is default (this info has to be sent back with the two updates), also to find the ID of the existing Dilbert icon.
  3. Post to the edit pics page to delete the existing icon.
  4. Upload the new icon, and parse the page to find out the new ID.
  5. Post to the edit pics page one final time to put the keyword on the newly uploaded icon.
The final step is to tie the three stages together and run them at a suitable time to catch the Dilbert site after it has been updated. Future plans include some code clean-up and handling the Sunday strip (if it will fit into 100KiB).

Update: W00t! It works! Todays strip is there completely sans human intervention.
Tags: geekery, lj
Subscribe

  • A Weekend in Tab-land (Part the Second)

    Despite copious drinks of water, frayer and I were still somewhat the worse for wear¹ when we emerged from the hotel on Saturday. We…

  • A random poll...

    This came from a discussion the other day about which are the best and ... er ... least best Pixar movies. To help answer that question, here's a…

  • Eee two the aye pie plus won

    Now that I've started moving back in, some more kitchen pics. At last, a home for my alcohol collection! And now for something completely random:

  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 12 comments
Please do me. I'm begging.
Alas, my 'plane tickets are for a fortnight from now :-(
You bought your tickets?!
Yah. Somehow I forgot to mention it last night. They weren't getting any cheaper - in fact they looked liable to get more expensive if I waited any longer.
Oooooh!!!! *excited* Email me details?

  • A Weekend in Tab-land (Part the Second)

    Despite copious drinks of water, frayer and I were still somewhat the worse for wear¹ when we emerged from the hotel on Saturday. We…

  • A random poll...

    This came from a discussion the other day about which are the best and ... er ... least best Pixar movies. To help answer that question, here's a…

  • Eee two the aye pie plus won

    Now that I've started moving back in, some more kitchen pics. At last, a home for my alcohol collection! And now for something completely random: