Ruby script to move Blogger photo links to point to Smugmug

SarnackeSarnacke Registered Users Posts: 1 Beginner grinner
I've been trying to move all of my stuff off my hosting provider. That includes moving my ftp-hosted Blogger blog back to run on Blogger's servers, and moving my blog images to Smugmug. The problem is that Smugmug generates unique IDs for each picture and (as far as I could tell) doesn't provide a way to access them by filename.

In order to change all of the image links in my 100+ blog posts, I wrote a Ruby script. Hopefully someone else will find this script useful as well.

First, the script assumes that you've moved all of the images for your blog into a single gallery. If you haven't, then this script won't work for you as-is.

Before running the script, please understand that this script modifies your blog posts and re-uploads them. It should be pretty safe, but it's best to backup your blog before allowing *anything* automated to mess with it!

To run the script, you'll need to have Ruby installed, and install the XMLSimple and JSON Ruby Gems. Really, I'm certain the script could be modified to do everything with JSON (to use the Google Data API with JSON, you just need to append a query parameter of "alt=json") but it works with the XML parser and I'm too lazy to clean it further.

In order to run the script, change the attached file name to end with a .rb, and give the file execute permissions. Edit the script and change all of the constants at the top to point at your specific IDs, passwords, galleries, etc. Back up your blog. Then just run it and go grab a beer.
Sign In or Register to comment.