Lurk all you'd like, but why not register and post some pics? Registering also makes it easier to find the good stuff. Need help?

Go Back   Digital Grin Photography Forum > Support > SmugMug APIs, Hacks & Tricks
Dgrinner
Password
Register FAQ Shooters Calendar Reviews Tutorials Gallery Books Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old Nov-19-2004, 05:02 AM   #1
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
smugmug command line tool in python

I have written a command line tool that uses the smugmug labs API to create gallereis, upload photos to them, and keep them updated as images change and new images are added locally. This is very useful if you want to treat you smugmug account as a mirror of a local directory tree. It also is not subject to the 100MB limit of the various browser based upload tools.

Who is this for? The brave, people who want to deal with a lot of photos and galleries, rogrammers; in short people like me. If you are not comfortable with command line programs, you won't like this. If you are aggressively non-technical, this isn't for you. But if you like to tinker and you aren't afraid of what's under the hood of your computer, this might be just the thing for you.

I have been using variants of this program for almost a year, but this version has been radically revised in hopes that it can be more than personal software. As such, I'm sure there will be bugs. Please email me with these. (please don't PM.) The program text contains a disclaimer, but I suppose I'd better add one here as well. Use this thing at your own risk. I won't be responsible for any damage it inflicts.

I have used and tested on OS X and on Linux. I have not tried on windows, but there really is no reason that it shouldn't work there. I have tried to be as portable as possible (and python allows a lot of this.) I'd like to hear about experiences on windows. Best of all, I'd like a python programmer on windows to smooth out the rough corners there.

Download sm_tool.py

Smugmug.py requires python 2.3 or better.

[Edited to reflect the true correct home of the script.]

Last edited by rutt; Mar-25-2006 at 07:57 AM.
rutt is offline   Reply With Quote
Old Nov-20-2004, 04:32 AM   #2
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Gallery creation issues

Gallery creation customizations don't work properly. I fixed a bug with my script. Pick up a new version. You want at least version 1.4 (look near the top of the script.)

Nevertheless, gallery creation currently ignores all parameters except the category. I strongly suspect an API bug and have submitted a bug. Stay tuned.
rutt is offline   Reply With Quote
Old Nov-22-2004, 07:42 AM   #3
David Ephron
Beginner grinner
 
Join Date: Nov 2004
Posts: 5
Thanks very much for posting this great tool!

So far, all I can get to work under Mac OS X is the simple upload command, but that's all I was looking for. By invoking your script within a do shell script command in applescript, I can now automate uploads to smugmug from within iView Media Pro.

DE.
David Ephron is offline   Reply With Quote
Old Nov-22-2004, 04:36 PM   #4
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Quote:
Originally Posted by David Ephron
Thanks very much for posting this great tool!

So far, all I can get to work under Mac OS X is the simple upload command, but that's all I was looking for. By invoking your script within a do shell script command in applescript, I can now automate uploads to smugmug from within iView Media Pro.

DE.
Please tell me about your other problems.
rutt is offline   Reply With Quote
Old Nov-23-2004, 08:32 AM   #5
David Ephron
Beginner grinner
 
Join Date: Nov 2004
Posts: 5
Quote:
Originally Posted by rutt
Please tell me about your other problems.
I am running Mac OS X 10.3.4. When I invoke your script with the update command from the terminal, I get:

Traceback (most recent call last):
File "/Users/dephron/Library/Application Support/SmugMug/smugmug.py", line 625, in ?
main()
File "/Users/dephron/Library/Application Support/SmugMug/smugmug.py", line 616, in main
update(Options(argv[2:]))
File "/Users/dephron/Library/Application Support/SmugMug/smugmug.py", line 577, in update
update_dir(smugmug,".",opts,listdir("."))
NameError: global name 'listdir' is not defined

The upload command works fine.
David Ephron is offline   Reply With Quote
Old Nov-23-2004, 09:27 AM   #6
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Quote:
Originally Posted by David Ephron
I am running Mac OS X 10.3.4. When I invoke your script with the update command from the terminal, I get:The upload command works fine.
Fixe. Get yourself a new copy here.
rutt is offline   Reply With Quote
Old Jul-07-2005, 05:33 PM   #7
mdm
Beginner grinner
 
Join Date: Jul 2005
Posts: 9
iView Applescript?

Quote:
Originally Posted by David Ephron
Thanks very much for posting this great tool!

So far, all I can get to work under Mac OS X is the simple upload command, but that's all I was looking for. By invoking your script within a do shell script command in applescript, I can now automate uploads to smugmug from within iView Media Pro.

DE.
David, please share your AppleScript with us. I'm new to AppleScript but would love to be able to upload from iView MediaPro.

Thanks!
Michael
mdm is offline   Reply With Quote
Old Mar-18-2005, 07:03 AM   #8
ryder
Beginner grinner
 
Join Date: Mar 2005
Posts: 2
Is there any reason why smugmug.py would stop working? I just subscribed to smugmug and found this script which is just what I was looking for. I ran it under linux and I can create empty galleries with it fine, and I can apparently upload photos with it, but the photos don't appear in the galleries! I uploaded quite a few photos overnight (with OK's at the end of each files upload) and they seem to have vanished. I've tried to do single file uploads as well with no luck. smugmug.py put out no errors or any other suspicous output.


Would the March 4th API changes have broken this? I tried changing the URL as descriped in the API change annoucement and the script still worked the same way. Uploads pictures, but they don't show up anywhere.

Thanks for any assistance! This is just the tool I need so I hope to be able to get it working one way for another
ryder is offline   Reply With Quote
Old Mar-18-2005, 08:26 AM   #9
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Quote:
Originally Posted by ryder
Is there any reason why smugmug.py would stop working? I just subscribed to smugmug and found this script which is just what I was looking for. I ran it under linux and I can create empty galleries with it fine, and I can apparently upload photos with it, but the photos don't appear in the galleries! I uploaded quite a few photos overnight (with OK's at the end of each files upload) and they seem to have vanished. I've tried to do single file uploads as well with no luck. smugmug.py put out no errors or any other suspicous output.


Would the March 4th API changes have broken this? I tried changing the URL as descriped in the API change annoucement and the script still worked the same way. Uploads pictures, but they don't show up anywhere.

Thanks for any assistance! This is just the tool I need so I hope to be able to get it working one way for another
It works for me as of yesterday and I have made no changes to it. Let's see if we can figure this out.

In the function post_multipart, you'll find some print statements that have been commented out. Try uncommenting them and try to upload just one file. What happens?
rutt is offline   Reply With Quote
Old Mar-18-2005, 08:59 AM   #10
ryder
Beginner grinner
 
Join Date: Mar 2005
Posts: 2
Did that, saw that the error was 'system error (nogallery) ' . When I saw that I realized that maybe I should be using the numeric ID of the gallery rather than the alphanumeric name. Tried that and it worked. Chalk one up to being a smugmug newbie. Thanks so much for the quick help!

Rich


Quote:
Originally Posted by rutt
It works for me as of yesterday and I have made no changes to it. Let's see if we can figure this out.

In the function post_multipart, you'll find some print statements that have been commented out. Try uncommenting them and try to upload just one file. What happens?
ryder is offline   Reply With Quote
Old Mar-18-2005, 09:14 AM   #11
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Quote:
Originally Posted by ryder
Did that, saw that the error was 'system error (nogallery) ' . When I saw that I realized that maybe I should be using the numeric ID of the gallery rather than the alphanumeric name. Tried that and it worked. Chalk one up to being a smugmug newbie. Thanks so much for the quick help!

Rich
I rarely use it in this low level mode. It supports two higher level models:


Suppose "VacationShots" is a directory full of jpgs from your trip. Cd there and do:
smugmug.py create "My Trip" *.jpg
After this, suppose you add a new shot to the directory VacationShots, perhaps a PS edit of one of the originals. You can always cd to VacationShots and do:
smugmug.py update
and it will find and upload any shots that are new or have changed since the last upload. It remembers the gallery from the create.

It has an even more high level usage model. Suppose you have a directory tree of galleries, each containing some shots and perhaps other directories. If you cd to the root of this tree and do:
smugmug.py full_update
it will crawl the entire directory tree making sure that a gallery exists for each directory in the tree that contains shots and uploading the shots not already uploaded.

Neither of these modes requires you to know the gallery_id.
rutt is offline   Reply With Quote
Old Apr-19-2005, 05:51 PM   #12
toybreaker
Beginner grinner
 
toybreaker's Avatar
 
Join Date: Apr 2005
Location: Woodland Hills,CA
Posts: 3
Huh

The link is broken.http://www.chezrutt.com/sm_tool/sm_tool.py
toybreaker is offline   Reply With Quote
Old Apr-19-2005, 05:55 PM   #13
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Quote:
Originally Posted by toybreaker
Sorry, it's http://www.chezrutt.com/rutt/sm_tool/sm_tool.py
rutt is offline   Reply With Quote
Old Apr-20-2005, 06:11 PM   #14
toybreaker
Beginner grinner
 
toybreaker's Avatar
 
Join Date: Apr 2005
Location: Woodland Hills,CA
Posts: 3
Quote:
Originally Posted by rutt
Yup! That one works.

**Caution** python.com is very different then python.org
toybreaker is offline   Reply With Quote
Old Jun-17-2005, 04:54 PM   #15
klettke
Big grins
 
klettke's Avatar
 
Join Date: Dec 2004
Posts: 12
I'm looking forward to using this plugin. However, no matter what I do it always gives me the error message:

No login and/or password. Both are required


I've tried putting the password/username on the command line as well as in .smugmugrc. Any suggestions?

Thanks!
klettke is offline   Reply With Quote
Old Jun-17-2005, 05:46 PM   #16
rutt
Cave canem!
 
rutt's Avatar
 
Join Date: Jan 2004
Location: Boston
Posts: 6,395
Quote:
Originally Posted by klettke
I'm looking forward to using this plugin. However, no matter what I do it always gives me the error message:

No login and/or password. Both are required


I've tried putting the password/username on the command line as well as in .smugmugrc. Any suggestions?

Thanks!
What OS are you using? Where is your .smugmugrc located? What does it look like (use XXX for password).
rutt is offline   Reply With Quote
Old Feb-26-2006, 07:46 PM   #17
gymshots
Big grins
 
Join Date: Feb 2006
Posts: 20
.smugmugrc

rutt,

I am new to python, and smugmug. I have some unix experience and plan on using sm_tool under windows 2000. It is not clear to me, what you
expect in the .smugmugrc file....I wondered if you could help me with the
syntax.

thanks
gymshots

Quote:
Originally Posted by rutt
I have written a command line tool that uses the smugmug labs API to create gallereis, upload photos to them, and keep them updated as images change and new images are added locally. This is very useful if you want to treat you smugmug account as a mirror of a local directory tree. It also is not subject to the 100MB limit of the various browser based upload tools.

Who is this for? The brave, people who want to deal with a lot of photos and galleries, rogrammers; in short people like me. If you are not comfortable with command line programs, you won't like this. If you are aggressively non-technical, this isn't for you. But if you like to tinker and you aren't afraid of what's under the hood of your computer, this might be just the thing for you.

I have been using variants of this program for almost a year, but this version has been radically revised in hopes that it can be more than personal software. As such, I'm sure there will be bugs. Please email me with these. (please don't PM.) The program text contains a disclaimer, but I suppose I'd better add one here as well. Use this thing at your own risk. I won't be responsible for any damage it inflicts.

I have used and tested on OS X and on Linux. I have not tried on windows, but there really is no reason that it shouldn't work there. I have tried to be as portable as possible (and python allows a lot of this.) I'd like to hear about experiences on windows. Best of all, I'd like a python programmer on windows to smooth out the rough corners there.

Download smugmug.py

Smugmug.py requires python 2.3 or better.
gymshots is offline   Reply With Quote
Old Feb-26-2006, 08:19 PM   #18
firecat53
Big grins
 
Join Date: Jun 2005
Posts: 13
Quote:
Originally Posted by gymshots
rutt,

I am new to python, and smugmug. I have some unix experience and plan on using sm_tool under windows 2000. It is not clear to me, what you
expect in the .smugmugrc file....I wondered if you could help me with the
syntax.

thanks
gymshots
login: login@email.com
password: smugmugpassword
public: True

That's all I used! Good luck....you'll probably have to try it a few times and experiment before you get it exactly how you want it. It's a good tool!

Scott
firecat53 is offline   Reply With Quote
Old Feb-27-2006, 06:00 PM   #19
gymshots
Big grins
 
Join Date: Feb 2006
Posts: 20
all set

thanks scott! It's working like a charm. great tool!



Quote:
Originally Posted by firecat53
login: login@email.com
password: smugmugpassword
public: True

That's all I used! Good luck....you'll probably have to try it a few times and experiment before you get it exactly how you want it. It's a good tool!

Scott
gymshots is offline   Reply With Quote
Old Mar-15-2006, 10:09 AM   #20
mugzy
Beginner grinner
 
Join Date: Mar 2006
Posts: 3
Ok, trying to get this working under xp.

I start in the directory with the images I want to upload.
I type "c:\sm_tool.py create b17 *"
It creates the b17 album, but does not upload images.

It works if I give it a specific filename instead of *.

Are wildcards allowed?
mugzy is offline   Reply With Quote
Reply

Tell The World!

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Times are GMT -8.   It's 10:07 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.