Smuggle

I needed to mirror some galleries from one smugmug account to another. I thought about doing it manually but that idea seemed like way too much work.

I found a python script by rutt that did a little bit of what I wanted and went to work hacking. This resulted in smuggle.py that may be useful if you ever have to programatically interact with the smugmug APIs. It will probably evolve as my needs change and as I actually start to learn python.

—The source is available from subversion.—

Update 12th of May, 2010

The subversion repository holding the original version of this has since gone away but in more recent times it has become easier to achieve this as there is a myriad of libraries out there. Below is an example in ruby of how easy it is to download images from a smugmug account. Upload is left as an exercise for the reader.

require smugmug
require fileutils
require net/http

Username = MyUser
Password = MyPassword
AlbumIDs = \[1234\]

puts Logging into \#{Username}”
sm = SmugMug::SmugMug.new(Username,Password)

sm.each do |a|
puts \#{a.title} - \#{a.album\_id}”
if AlbumIDs.include?( a.album\_id )
FileUtils.mkdir\_p \#{a.album\_id}”
a.each do |image|
puts \#{image.file\_name} has url \#{image.original\_url}”
filename = \#{a.album\_id}/\#{image.image\_id}\#{File.extname(image.file\_name)}”
File.open(filename,w) do |f|
f.write Net::HTTP.get(URI.parse(\#{image.original\_url}”))
end unless File.exist?( filename )
end
end
end