View Full Version : smugmug command line tool in python
rutt
Nov-19-2004, 05:02 AM
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 (http://sourceforge.net/projects/sm-photo-tool)
Smugmug.py requires python 2.3 or better.
[Edited to reflect the true correct home of the script.]
rutt
Nov-20-2004, 04:32 AM
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.
David Ephron
Nov-22-2004, 07:42 AM
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.
rutt
Nov-22-2004, 04:36 PM
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.
David Ephron
Nov-23-2004, 08:32 AM
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.
rutt
Nov-23-2004, 09:27 AM
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 (http://www.chezrutt.com/rutt/smugmug/smugmug.py).
digimatt
Jan-20-2005, 10:36 AM
The script works fine on Windows(so far) using python included the cygwin unix environment. I haven't used it for much other than uploading.. Haven't played with the creation stuff yet.
Cygwin gives you a bash shell, complete with unix style path's, home dirtectory, etc. Get it at http://www.cygwin.com
NOTE:
While you are in the cygwin environment, you need to use unix style path names. All windows drives are mounted under /cygdrive/ . So, to access files on the c: drive, you would access them through /cygdrive/c/ . ie., the path "c:\mypic.jpg" would be translated to "/cygdrive/c/mypic.jpg". Also, if there are any spaces in the path, like in "My Pictures", you need to escape the spaces, or wrap quotation marks around the entire path.
Thanks for the script!
-Matt M.
vthokiestm
Feb-24-2005, 12:39 PM
Hi,
I'd love to try this out. The java uploader is annoying for Linux...
but when trying to download the script and get a file not found error.
Can someone email me the file or tell me where to find it? I could host it on my site if needed also...
Thanks,
Brian
rutt
Feb-24-2005, 06:13 PM
Hi,
I'd love to try this out. The java uploader is annoying for Linux...
but when trying to download the script and get a file not found error.
Can someone email me the file or tell me where to find it? I could host it on my site if needed also...
Thanks,
Brian
This URL works for me: http://www.chezrutt.com/rutt/smugmug/smugmug.py
vthokiestm
Feb-24-2005, 08:41 PM
Sorry, I was at work earlier and they block all ports other than 80.
Got it now. Thanks!
ryder
Mar-18-2005, 07:03 AM
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 :):
rutt
Mar-18-2005, 08:26 AM
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?
ryder
Mar-18-2005, 08:59 AM
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
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
Mar-18-2005, 09:14 AM
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.
toybreaker
Apr-19-2005, 05:51 PM
The link is broken.http://www.chezrutt.com/sm_tool/sm_tool.py:dunno
rutt
Apr-19-2005, 05:55 PM
The link is broken.http://www.chezrutt.com/sm_tool/sm_tool.py:dunno
Sorry, it's http://www.chezrutt.com/rutt/sm_tool/sm_tool.py
toybreaker
Apr-20-2005, 06:11 PM
Sorry, it's http://www.chezrutt.com/rutt/sm_tool/sm_tool.py
Yup! That one works.
**Caution** python.com is very different then python.org:doh
klettke
Jun-17-2005, 04:54 PM
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!
rutt
Jun-17-2005, 05:46 PM
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).
klettke
Jun-17-2005, 10:05 PM
Hey,
Sorry for not providing any details.I'm running Linux (Debiain), Python 2.3.5, and the .smugmugrc is in the same directory as sm_tool.py, (the directory with the pictures).
The syntax was: ./sm_tool.py --login=LOGIN --password=PASSWORD create Trip (and I've tried combos of this with quotes around login/pass and gallery name.
Thanks for your help,
Scott
What OS are you using? Where is your .smugmugrc located? What does it look like (use XXX for password).
rutt
Jun-18-2005, 04:43 AM
Hey,
Sorry for not providing any details.I'm running Linux (Debiain), Python 2.3.5, and the .smugmugrc is in the same directory as sm_tool.py, (the directory with the pictures).
The syntax was: ./sm_tool.py --login=LOGIN --password=PASSWORD create Trip (and I've tried combos of this with quotes around login/pass and gallery name.
Thanks for your help,
Scott
The .smugmugrc is supposed to be in your home directory (~). If you put your login and password there, things should work.
The command line syntax is a little different that what you used. Note, that it says:
smugmug.py create gallery_name [options] [file...]
That means that the options come after the command name (in this case "create"). Move them there and it will also work.
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
mwgrice
Jul-24-2005, 10:45 AM
I used sm_tool.py last night to upload a few hundred photos. Nice, very nice.
I had to pull sm_tool.py out of the Google cache, though. Apparently www.chezrutt.com (http://www.chezrutt.com) is redirecting to gate.chezrutt.com on port 8030, which is refusing connections (perhaps the web server is not listening).
Anybody got a recent copy of this script? I think mine might be older as the create function doesn't actually work for me from OS X. If you have a reasonably recent version of this tool, please email it to mdm [at] tanagra [dot] com. I'd even be happy to host it - it's so small.
Thanks!
Michael
I had to pull sm_tool.py out of the Google cache, though. Apparently www.chezrutt.com (http://www.chezrutt.com) is redirecting to gate.chezrutt.com on port 8030, which is refusing connections (perhaps the web server is not listening).
rutt
Aug-09-2005, 06:46 AM
Anybody got a recent copy of this script? I think mine might be older as the create function doesn't actually work for me from OS X. If you have a reasonably recent version of this tool, please email it to mdm [at] tanagra [dot] com. I'd even be happy to host it - it's so small.
Thanks!
Michael
I'm sorry, I've had sort of an IT infrastructure meltdown and I no longer have a great way to provide access to script, at least until September. I've sent mdm a copy of the most recent version of the script. Great if he hosts it.
I'm sorry, I've had sort of an IT infrastructure meltdown and I no longer have a great way to provide access to script, at least until September. I've sent mdm a copy of the most recent version of the script. Great if he hosts it.
And here it is:
http://michaelmcdaniel.net/files/sm_tool.py
Rutt, just let me know if you update the script so I can stay up to date! :):
yahootintin
Oct-07-2005, 02:03 PM
I'm running this on Windows XP. The file upload doesn't seem to work for me. When I run full_update I get the galleries created and lines like this that make it appear like the files were uploaded:
.\A611904_May\25871677_2005-05-19~13-47~1.jpg...[OK] 2298927 bytes 0 seconds 2834KB/sec ETA 6
.\A611904_May\25871688_2005-05-20~16-43~1.jpg...[OK] 1050724 bytes 0 seconds 1811KB/sec ETA 9
.\A611904_May\25871733_2005-05-20~17-34~1.jpg...[OK] 1535479 bytes 186 seconds 8KB/sec ETA 33:02
.\A611904_May\25871843_2005-05-20~17-48~1.jpg...[OK] 2538017 bytes 0 seconds 3017KB/sec ETA 4
Any idea why the photos aren't showing up?
And here it is:
http://michaelmcdaniel.net/files/sm_tool.py
Rutt, just let me know if you update the script so I can stay up to date! :):
Version 1.10 fixes this problem for windows (thanks, Rutt!) and is now available at:
http://www.michaelmcdaniel.net/files/sm_tool.py
Enjoy!
--Michael
firecat53
Dec-13-2005, 03:26 PM
Great tool! I'm sure it's me still being relatively new at Linux, but I can't seem to get smugmug.py to background happily and continue to function. I ssh into my home server, then run:
smugmug.py create 2005-October --category=Family 2005-10-18/* 2005-10-24/* --quiet &
It runs happily (I can see the pictures being updated on the website) as long as the terminal window (ssh session) stays open. As soon as I log out (close the window, because it won't logout like normal), it stops functioning. If I ssh in again, I can still see the python process running, but it's not doing anything (website not updating).
Thanks!
Scott
rutt
Dec-13-2005, 04:22 PM
If I ssh in again, I can still see the python process running, but it's not doing anything (website not updating).
Thanks!
Scott
Try using something like:
nohup smtool.py ... &
and see what happens.
firecat53
Dec-13-2005, 07:15 PM
Adding "nohup" before the smugmug.py command seemed to work. I still can't logout of the ssh session normally -- I have to close that terminal window, but the script keeps running! Thanks a lot :)
I already have a significant number of pix on smugmug arranged in galleries that aren't directly related to the directory names. From the pictures 'root' directory (Family Pictures), I ran smugmug.py create October-2005 .......adding two directories (2005-10-18 and 2005-10-24) worth of files on the same command line. After that finished, I tried to run smugmug.py create November-2005 2005-11-18/* from the same root directory. Because the SMUGMUG-INFO directory was created in that 'root' directory, it only had the gallery entry for the October gallery, and so started adding the November pictures to the October-2005 directory instead. So I had to stop and use the smugmug.py upload 1039405 2005-11-18/* to get the pictures into the right gallery.
Maybe a future release could include support for uploading to one gallery from multiple directories and still retaining the SMUGMUG_INFO. Until then, I think I can work around just fine :) Thanks very much for a great script!! Now I can semi-automate my updates and not worry about someone else closing the darn browser in the middle of an upload!
Scott
Scott
rutt
Dec-14-2005, 04:24 AM
I use links in separate galleries to get this effect.
firecat53
Dec-14-2005, 07:11 AM
*sigh* Please forgive my 'density', but I can't figure out what you mean by 'using links in separate galleries'.
Thanks a lot for your help!!
Scott
rutt
Dec-14-2005, 07:34 AM
On Unix and Linux you can make separate directories (folders) which contain subsets of the very same image. For example, suppose you have all your family shots in one directory: ~/photos/family_shots and now you would like separate directories for pictures from 2005 and 2004. Just to make this easier, suppose your 2005 pictures are all named like: img_XXXX_2005.jpg and simlarly for the 2004 shots.
Then you can do this in a command shell:
mkdir 2004
cd 2004
ln -s ~/photos/family_shots/*2004*.jpg .
cd ..
mkdir 2005
cd 2005
ln -s ~/photos/family_shots/*2005*.jpg .
Now you can run sm_tool.py separately in the 2004 or 2005 directories, or in the root of the two with full_update.
gymshots
Feb-26-2006, 07:46 PM
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
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 (http://www.chezrutt.com/rutt/smugmug/smugmug.py)
Smugmug.py requires python 2.3 or better.
firecat53
Feb-26-2006, 08:19 PM
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
gymshots
Feb-27-2006, 06:00 PM
thanks scott! It's working like a charm. great tool!
:):
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
mugzy
Mar-15-2006, 10:09 AM
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?
rutt
Mar-15-2006, 10:25 AM
Wild cards work on *nix, including OS X, but I'm not sure about XP. The various unix and linux shells expand wild cards before passing to the program, so the program doesn't actually have to do anything. What if you type "*.JPG" or "*.jpg" depending on what you have?
If you look in the script, you'll find a function like this:
def update_dir(smugmug,dir,opts,files):
li = LocalInformation(dir)
files_to_upload = []
for f in files:
if re.match(opts.filter_regular_expression,f):
file = path.join(dir,f)
if li.file_needs_upload(file):
files_to_upload.append(file)
if len(files_to_upload) > 0:
files_to_upload.sort()
smugmug.upload_files(li.gallery_id(),opts,files_to _upload,
local_information=li)
If you add line to print the files, like this, you may be able to figure it out:
def update_dir(smugmug,dir,opts,files):
li = LocalInformation(dir)
files_to_upload = []
for f in files:
print f
if re.match(opts.filter_regular_expression,f):
file = path.join(dir,f)
if li.file_needs_upload(file):
files_to_upload.append(file)
if len(files_to_upload) > 0:
files_to_upload.sort()
smugmug.upload_files(li.gallery_id(),opts,files_to _upload,
local_information=li)
Check if there is a new folder SMUGMUG_INFO in the folder after you run. The files there might also be interesting.
mugzy
Mar-15-2006, 10:31 AM
Wild cards work on *nix, including OS X, but I'm not sure about XP. The various unix and linux shells expand wild cards before passing to the program, so the program doesn't actually have to do anything. What if you type "*.JPG" or "*.jpg" depending on what you have?
I thought it might be something like this. I should have looked at the code first.
It looks like windows does not expand the wild cards. I will either brush up on my python, or throw together a quick .vbs to break up the wild card.
Thanks
rutt
Mar-15-2006, 10:34 AM
Adding windows wild card expansion to the script has to be pretty easy and would be a boon to all the other 10s of thousands of people who use it. Catch the exception when you try to import the function and you'll know whether or not you have to use it.
zanthrus
Mar-24-2006, 11:08 AM
I had to do a couple things to get this to work in WindowsXP.
1.) I had to define a HOME environment variable to avoid a KeyError. I think you could resolve this by trying HOME first, and then falling back to USERPROFILE which I think is set by default in windows to C:\Documents and Settings\[Username]
2.) File uploads refused to work. When reading files in, only the first 58 bytes of my *.jpg would be read. Fixing this is as simple as opening the file in binary mode:
f = file(name,"rb")
I think both these fixes are simple enough that cross-platform compatibility won't be damaged.
Other than that, this thing looks fantastic. I might add some new features to it if I ever get the time. I'd like the ability to synchronize everything with Smugmug. Uploading is great, but if I change captions or titles on the website I'd like to get a local copy of that information.
rutt
Mar-25-2006, 07:54 AM
The part about opening in binary mode should have been fixed already. Did you see:
http://www.dgrin.com/showpost.php?p=178628&postcount=28
Where did you pick up the script?
I had to do a couple things to get this to work in WindowsXP.
1.) I had to define a HOME environment variable to avoid a KeyError. I think you could resolve this by trying HOME first, and then falling back to USERPROFILE which I think is set by default in windows to C:\Documents and Settings\[Username]
2.) File uploads refused to work. When reading files in, only the first 58 bytes of my *.jpg would be read. Fixing this is as simple as opening the file in binary mode:
f = file(name,"rb")
I think both these fixes are simple enough that cross-platform compatibility won't be damaged.
Other than that, this thing looks fantastic. I might add some new features to it if I ever get the time. I'd like the ability to synchronize everything with Smugmug. Uploading is great, but if I change captions or titles on the website I'd like to get a local copy of that information.
zanthrus
Mar-25-2006, 09:56 AM
The part about opening in binary mode should have been fixed already. Did you see:
http://www.dgrin.com/showpost.php?p=178628&postcount=28
Where did you pick up the script?
I got it from http://gate.chezrutt.com:8030/rutt/sm_tool/sm_tool.py. It says it's version 8. I updated to version 10, and the fix is there already.
Thanks
Edit, found a nice fix for the first problem, use os.path.join(os.path.expanduser("~"), ".smugmugrc") to find the file instead of bothering with environment variables.
tsk1979
Apr-23-2006, 12:38 AM
Just what I was looking for. I have couple of questions. We have the option of "update" and "upload". Suppose I have many files in the dir.
I want to do update, but it will upload all image files which are not there in the gallery, so is it possible that I give it a file list. and it checkes if those files are there and then updates?
For example my dir may have files like img_a_001.jpg. img_b_001.jpg....
I want to upload only img_b_00*.jpg and nothing else. I can sure use wildcards, but if there is a possiblity of giving a text file as the list of files relative to the current dir tree this will be good. that I can use a complex script to create a txt list of files and then give this list to this script to upload!
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 (http://www.michaelmcdaniel.net/files/sm_tool.py)
Smugmug.py requires python 2.3 or better.
[Edited to reflect the true correct home of the script.]
mpmcleod
Apr-23-2006, 03:03 PM
Just what I was looking for. I have couple of questions. We have the option of "update" and "upload". Suppose I have many files in the dir.
I want to do update, but it will upload all image files which are not there in the gallery, so is it possible that I give it a file list. and it checkes if those files are there and then updates?
For example my dir may have files like img_a_001.jpg. img_b_001.jpg....
I want to upload only img_b_00*.jpg and nothing else. I can sure use wildcards, but if there is a possiblity of giving a text file as the list of files relative to the current dir tree this will be good. that I can use a complex script to create a txt list of files and then give this list to this script to upload!
How fast should this be?
sm_tool.py works fast for about 20 files and then slows way down. From my office with T3+ speeds it only uploaded about 500 files in 10 hours. I need to upload 30,000 files.
thanks,
rutt
Apr-23-2006, 03:20 PM
How fast should this be?
sm_tool.py works fast for about 20 files and then slows way down. From my office with T3+ speeds it only uploaded about 500 files in 10 hours. I need to upload 30,000 files.
thanks,
I don't have that experience, but I've never had such a fast connection either. After each file uploaded, sm_tool.py prints a speed and estimate of time remaining. What does that look like for you?
Do you have any experience ftp'ing or ssh'ing large collections of files outward from to someplace with a good connection? What happens?
tsk1979
Apr-23-2006, 06:02 PM
How fast should this be?
sm_tool.py works fast for about 20 files and then slows way down. From my office with T3+ speeds it only uploaded about 500 files in 10 hours. I need to upload 30,000 files.
thanks,
I tried this for about 100 files on a 1Mbps link, the speed was always hovering near the limit. I think its some throttling at your office, when It detects a connection going at the limit for a prolonged period of time, poof it throttles. This tool is just pushing the data to smugmug, so does not mater 10 files or 10,000 files.
mpmcleod
Apr-24-2006, 08:08 AM
I don't have that experience, but I've never had such a fast connection either. After each file uploaded, sm_tool.py prints a speed and estimate of time remaining. What does that look like for you?
Do you have any experience ftp'ing or ssh'ing large collections of files outward from to someplace with a good connection? What happens?
I have moved over 100GB of other data between the office and an offsite compute cluster in less than one hour (during lunch) using SFTP.
I will do some more digging and play some more.
thanks,
mpmcleod
Apr-24-2006, 09:24 AM
I have moved over 100GB of other data between the office and an offsite compute cluster in less than one hour (during lunch) using SFTP.
I will do some more digging and play some more.
thanks,
When I run this in a directory with 30,000 files I get an error.
using phython2.3
>../sm_tool.py full_update
Traceback (most recent call last):
File "../sm_tool.py", line 656, in ?
main()
File "../sm_tool.py", line 649, in main
full_update(Options(argv[2:]))
File "../sm_tool.py", line 625, in full_update
create(smugmug,name,root,opts)
File "../sm_tool.py", line 563, in create
album_id = smugmug.create_album(name,opts)
File "../sm_tool.py", line 227, in create_album
return self.sp.createAlbum(self.session,name,category,pro perties)
File "/usr/lib/python2.3/xmlrpclib.py", line 1029, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.3/xmlrpclib.py", line 1316, in __request
verbose=self.__verbose
File "/usr/lib/python2.3/xmlrpclib.py", line 1080, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.3/xmlrpclib.py", line 1219, in _parse_response
return u.close()
File "/usr/lib/python2.3/xmlrpclib.py", line 742, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <fault 10="" missing="" title="">
using python2.4
Traceback (most recent call last):
File "../sm_tool.py", line 656, in ?
main()
File "../sm_tool.py", line 649, in main
full_update(Options(argv[2:]))
File "../sm_tool.py", line 625, in full_update
create(smugmug,name,root,opts)
File "../sm_tool.py", line 563, in create
album_id = smugmug.create_album(name,opts)
File "../sm_tool.py", line 227, in create_album
return self.sp.createAlbum(self.session,name,category,pro perties)
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 10: 'missing title'>
am I missing something?
Is there a limit to the number of files sm_tool can handle?
</fault>
mpmcleod
Apr-24-2006, 11:13 PM
This may indeed be some sort of problem on my end (or between SM and myself).
I threw together a very rough hack using perl to do the same job and it loads 20 files quite fast and smooth and then hangs. My code doesn't have a timeout so instead of breaking it just stays hung until I kill it.
I have sent an email to my IT people to see what the problem might be.
thanks,
<fault 10="" missing="" title=""></fault>
tsk1979
Apr-30-2006, 03:19 AM
I have a gallery called files under the category "Other".
Now on the machine there is a directory called files with lots of jpg files(135M)
To upload all the files to the gallery files, should I give the following command line
./sm_tool.py upload files files/*jpg --category=Other
I did this and got the following erros. I have my ~/.smugmugrc file with login, password and public: True
./sm_tool.py upload files files/* --category=Other
Traceback (most recent call last):
File "./sm_tool.py", line 656, in ?
main()
File "./sm_tool.py", line 645, in main
upload(argv[2],Options(argv[3:]))
File "./sm_tool.py", line 598, in upload
smugmug = Smugmug(opts.login,opts.password)
File "./sm_tool.py", line 178, in __init__
self.login()
File "./sm_tool.py", line 184, in login
rep = self.sp.loginWithPassword(self.account,self.passwo rd,self.api_version)
File "/usr/lib/python2.3/xmlrpclib.py", line 1032, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.3/xmlrpclib.py", line 1319, in __request
verbose=self.__verbose
File "/usr/lib/python2.3/xmlrpclib.py", line 1065, in request
self.send_content(h, request_body)
File "/usr/lib/python2.3/xmlrpclib.py", line 1179, in send_content
connection.endheaders()
File "/usr/lib/python2.3/httplib.py", line 715, in endheaders
self._send_output()
File "/usr/lib/python2.3/httplib.py", line 600, in _send_output
self.send(msg)
File "/usr/lib/python2.3/httplib.py", line 567, in send
self.connect()
File "/usr/lib/python2.3/httplib.py", line 987, in connect
sock.connect((self.host, self.port))
File "<string>", line 1, in connect
socket.error: (111, 'Connection refused')
Exception exceptions.AttributeError: "Smugmug instance has no attribute 'session'" in <bound method Smugmug.__del__ of <__main__.Smugmug instance at 0x40276c4c>> ignored
rutt
Apr-30-2006, 05:21 AM
This looks to me as if you aren't getting through to smugmug at all. See the connection refused message at the bottom of the error report.
You can try adding some print statements near the apparent ssource of the problem:
print self.account
print self.password
print self.api_version
rep = self.sp.loginWithPassword(self.account,self.passwo rd,self.api_version)
print rep
I have a gallery called files under the category "Other".
Now on the machine there is a directory called files with lots of jpg files(135M)
To upload all the files to the gallery files, should I give the following command line
./sm_tool.py upload files files/*jpg --category=Other
I did this and got the following erros. I have my ~/.smugmugrc file with login, password and public: True
./sm_tool.py upload files files/* --category=Other
Traceback (most recent call last):
File "./sm_tool.py", line 656, in ?
main()
File "./sm_tool.py", line 645, in main
upload(argv[2],Options(argv[3:]))
File "./sm_tool.py", line 598, in upload
smugmug = Smugmug(opts.login,opts.password)
File "./sm_tool.py", line 178, in __init__
self.login()
File "./sm_tool.py", line 184, in login
rep = self.sp.loginWithPassword(self.account,self.passwo rd,self.api_version)
File "/usr/lib/python2.3/xmlrpclib.py", line 1032, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.3/xmlrpclib.py", line 1319, in __request
verbose=self.__verbose
File "/usr/lib/python2.3/xmlrpclib.py", line 1065, in request
self.send_content(h, request_body)
File "/usr/lib/python2.3/xmlrpclib.py", line 1179, in send_content
connection.endheaders()
File "/usr/lib/python2.3/httplib.py", line 715, in endheaders
self._send_output()
File "/usr/lib/python2.3/httplib.py", line 600, in _send_output
self.send(msg)
File "/usr/lib/python2.3/httplib.py", line 567, in send
self.connect()
File "/usr/lib/python2.3/httplib.py", line 987, in connect
sock.connect((self.host, self.port))
File "<string>", line 1, in connect
socket.error: (111, 'Connection refused')
Exception exceptions.AttributeError: "Smugmug instance has no attribute 'session'" in <bound method Smugmug.__del__ of <__main__.Smugmug instance at 0x40276c4c>> ignored
tsk1979
May-01-2006, 09:58 AM
What is the port through which the connection goes to smugmug. I think that port may be closed as outgoing connections are allowed through port 80 only for now.
This looks to me as if you aren't getting through to smugmug at all. See the connection refused message at the bottom of the error report.
You can try adding some print statements near the apparent ssource of the problem:
print self.account
print self.password
print self.api_version
rep = self.sp.loginWithPassword(self.account,self.passwo rd,self.api_version)
print rep
rutt
May-01-2006, 11:41 AM
What is the port through which the connection goes to smugmug. I think that port may be closed as outgoing connections are allowed through port 80 only for now.
That would account for it. it's on 443, the standard port for https.
tsk1979
May-03-2006, 09:49 PM
That would account for it. it's on 443, the standard port for https.
A clarification about the upload script.
suppose I alread have a gallery called files in category Other.
In the sm_tool.py upload option there is something called "Gallery Id". This will be the gallery name, ie "files"?
mpmcleod
May-04-2006, 06:34 AM
A clarification about the upload script.
suppose I alread have a gallery called files in category Other.
In the sm_tool.py upload option there is something called "Gallery Id". This will be the gallery name, ie "files"?
I'll jump in here. The gallery id is the number of the gallery. http://<username>USERNAME.smugmug.com/gallery/NUMBERS</username> (http://xxxx.smugmug.com/gallery/123456)
in this case the gallery id is 123456
I had /gallery/123456 in the example but it turns out
1) 123456 is a real gallery id
2) you can link there regardless of the username (I think this is a strange "feature")
Thanks Rutt for this tool.
-- Mike
gymshots
May-26-2006, 03:33 PM
I needed to identify the original file name of images on smugmug and of images sold. The sales data only provides the image number from their database so that made it hard to figure out which original files sold.
I wrote two extensions to rutt's python tool to do two things:
1) getFileInfo 'photoId'
takes the photo ID from the URL (the last numbers before the '/' in the URL)
and returns the original file name and gallery where it is loaded. This helps me quickly locate the CD where I have backed up the image, if I wish to retrieve the original image from archive.
2) getInfoFiles filename<FILENAME>
this is really a batch job that answers the same question as #1 above.
where 'filename' <FILENAME>is a file that contains a list of the image URLs exported from the sales data. it retrieves the file name and gallery where these images came from and puts them into a '!' delimited file with the .out extension. This file in turn can be imported back into the sales data and used to sort the sales data on original file name and event/gallery.
if anybody is interested, I will post the extensions in this thread.
Susan Jones
gymshots.smugmug.com
jaimielan
Jun-06-2006, 05:53 PM
Love the script. I am doing some major archiving and the full update feature is terrific.
I have run in to this error, it is a minor inconvenience in that I let the script run all night and find out that it errored out at 4 am. Any ideas? (BTW, I am using OS X 10.4.6)
File "smugmug.py", line 656, in ?
main()
File "smugmug.py", line 649, in main
full_update(Options(argv[2:]))
File "smugmug.py", line 626, in full_update
update_dir(smugmug,root,opts,files)
File "smugmug.py", line 579, in update_dir
local_information=li)
File "smugmug.py", line 293, in upload_files
self.upload_file(albumid,file,caption(file,opts))
File "smugmug.py", line 331, in upload_file
self.post_multipart("upload.smugmug.com","/photos/xmladd.mg",fields,[file])
File "smugmug.py", line 346, in post_multipart
h.send(body)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/httplib.py", line 579, in send
self.sock.sendall(str)
File "<string>", line 1, in sendall
socket.error: (32, 'Broken pipe')
</string>
<filename><filename></filename></filename>
rutt
Jun-06-2006, 06:29 PM
I'm pretty sure it means that smugmug timed out or the connection was otherwise broken perhaps by some network flakiness.
Love the script. I am doing some major archiving and the full update feature is terrific.
I have run in to this error, it is a minor inconvenience in that I let the script run all night and find out that it errored out at 4 am. Any ideas? (BTW, I am using OS X 10.4.6)
File "smugmug.py", line 656, in ?
main()
File "smugmug.py", line 649, in main
full_update(Options(argv[2:]))
File "smugmug.py", line 626, in full_update
update_dir(smugmug,root,opts,files)
File "smugmug.py", line 579, in update_dir
local_information=li)
File "smugmug.py", line 293, in upload_files
self.upload_file(albumid,file,caption(file,opts))
File "smugmug.py", line 331, in upload_file
self.post_multipart("upload.smugmug.com","/photos/xmladd.mg",fields,[file])
File "smugmug.py", line 346, in post_multipart
h.send(body)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/httplib.py", line 579, in send
self.sock.sendall(str)
File "<string>", line 1, in sendall
socket.error: (32, 'Broken pipe')
</string>
<filename><filename></filename></filename>
jaimielan
Jun-06-2006, 07:14 PM
I'm pretty sure it means that smugmug timed out or the connection was otherwise broken perhaps by some network flakiness.
That's entirely possible, I am in South America at the moment and flakiness is a way of life when it comes to internet connections.
heinz e
Aug-08-2006, 02:29 AM
Download sm_tool.py (http://www.michaelmcdaniel.net/files/sm_tool.py)
I use ver 1.10 as above. I have modified it slightly to
get it to work. (Swedish national characters in directory
names will not work.)
Is the script maintained by anyone?
Are there newer versions than 1.10 available.
rutt
Aug-08-2006, 06:33 AM
I wrote it and use it all the time. I'll look at bugs. There are a few other people around who also use it. If you have some fixes, post a new version or a patch here and Michael who hosts it will probably pick it up.
tdhock@ocf.berkeley.edu
Aug-20-2006, 07:19 PM
I wrote it and use it all the time. I'll look at bugs. There are a few other people around who also use it. If you have some fixes, post a new version or a patch here and Michael who hosts it will probably pick it up.
This isn't a bug --- just a comment. I'm a python programmer as well and I noticed that your long help message is encoded in your source by repeatedly using string concatenation over multiple lines. An easier way to do this in python is by using triple quotes, i.e.
self.parser = OptionParser(
self.short_usage + """
Create smugmug galleries and upload to them. Mirror directory trees
on smugmug and keep up to date.
...
"""
The tool seems to work nicely so far. Great work!
jmrodri
Oct-05-2006, 05:30 PM
I love sm_tool.py. I've packaged it up in an RPM for use with Fedora Core. I use it daily. Is the code hosted anywhere? i.e. sourceforge, etc.?
jesus rodriguez
rutt
Oct-05-2006, 05:41 PM
I love sm_tool.py. I've packaged it up in an RPM for use with Fedora Core. I use it daily. Is the code hosted anywhere? i.e. sourceforge, etc.?
jesus rodriguez
I appreciate that. I wrote this thing as personal software to solve a problem of my own. I've never gotten a good sense of how many people actually use this (though I think the SM people might be able to answer this.)
Anyway, it's never really grown out of a very informal sort of sharing. I'd be happy if someone picked it up and helped it grow up and move away from its parent's home.
jmrodri
Oct-07-2006, 11:09 AM
I appreciate that. I wrote this thing as personal software to solve a problem of my own. I've never gotten a good sense of how many people actually use this (though I think the SM people might be able to answer this.)
Anyway, it's never really grown out of a very informal sort of sharing. I'd be happy if someone picked it up and helped it grow up and move away from its parent's home.
If you don't mind, I would be happy to create a sourceforge type project for
it. And be the Fedora Core package maintainer for it. I will post here with
the project site once it's ready.
sincerely,
jesus rodriguez
jmrodri
Oct-07-2006, 11:16 AM
If you don't mind, I would be happy to create a sourceforge type project for
it. And be the Fedora Core package maintainer for it. I will post here with
the project site once it's ready.
sincerely,
jesus rodriguez
sm_tool is not a valid project name, smtool conflicts with an existing
sourceforge project. If you don't mind I'd like to name it
sm-photo-tool. Let me know if that's ok. If you don't care, let me know
as well :)
jmrodri
Oct-07-2006, 11:45 AM
Here is the home of sm_tool.py. As I said earilier, sm_tool was
an invalid project name. So I used sm-photo-tool.
http://code.google.com/p/sm-photo-tool/
I will be checking in the Fedora Core packaging later this week.
bluemeanie
Nov-13-2006, 07:34 PM
Hi,
Nice tool. I actually took part of the scipt, enhanced and modified it to make it easy to mirror galleries between multiple accounts. If your a programmer and need an interface to work with smugmug galleries you may find it useful. Thanks!
http://www.realityforge.org/articles/2006/11/14/smuggle
rutt
Oct-17-2007, 08:46 AM
My version of this script stopped working for me on Sunday (after chugging along unchanged for years.) The power of open-source payed off and before I even got around to trying to debug it, the sm_tool.py user community found and submitted a bug fix. Basiccally, use a different URL for initializing the connection, and pass the API key.
Here is a diff:
--- sm_tool.py.~6~ 2006-09-17 10:49:45.000000000 -0400
+++ sm_tool.py 2007-10-16 19:52:24.000000000 -0400
@@ -162,10 +162,11 @@
def __init__(self,account,passwd):
self.account = account
self.password = passwd
- self.sp = ServerProxy("https://upload.smugmug.com/xmlrpc/")
-# self.sp = ServerProxy("https://api.smugmug.com/hack/xmlrpc/beta.mg",
-# transport=CURLTransport())
+# self.sp = ServerProxy("https://upload.smugmug.com/xmlrpc/")
+ self.sp = ServerProxy("https://api.smugmug.com/hack/xmlrpc/1.1.1/",
+ transport=CURLTransport())
self.api_version = "1.0"
+ self.api_key = "COZkd1MBtHQtgs0zf2OQ4KTaiIk3ehVs"
self.categories = None
self.subcategories = None
self.login()
@@ -174,7 +175,9 @@
self.logout()
def login(self):
- rep = self.sp.loginWithPassword(self.account,self.passwo rd,self.api_version)
+ rep = self.sp.loginWithPassword(self.account,self.passwo rd,
+ self.api_version,
+ self.api_key)
self.session = rep['SessionID']
def logout(self):
devbobo
Oct-17-2007, 03:34 PM
rutt,
you may want to replace the version of the script linked in the original post.
:thumb
David
jmrodri
Oct-17-2007, 07:01 PM
I'm sorry, I've had sort of an IT infrastructure meltdown and I no longer have a great way to provide access to script, at least until September. I've sent mdm a copy of the most recent version of the script. Great if he hosts it.
I put the script under subversion:
http://sm-photo-tool.sourceforge.net/
Download the release here:
http://sourceforge.net/projects/sm-photo-tool
gymshots
Oct-18-2007, 07:56 PM
Hi Rutt...
I use your tool often (thanks!) and noticed it is broken, too. I tried to make your changes - but when I try to login, I get the following errors below.
(mind you I wrote an extension to your tool that I have been using for over a year, unchanged. It allows me to plug in the photograph ID from the URL and look up the name of my photograph in the command line.)
$ sm_tool.py getFileInfo 193759560
Traceback (most recent call last):
File "/usr/bin/sm_tool.py", line 744, in ?
main()
File "/usr/bin/sm_tool.py", line 735, in main
getInfo(argv[2],Options(argv[3:]))
File "/usr/bin/sm_tool.py", line 672, in getInfo
smugmug = Smugmug(opts.login,opts.password)
File "/usr/bin/sm_tool.py", line 186, in __init__
transport=CURLTransport())
NameError: global name 'CURLTransport' is not defined
here is the fragment of script changes:
class Smugmug:
def __init__(self,account,passwd):
from sys import stderr
# probably don't need to hard code this after all - FIXXME
self.account = account
self.password = password
self.sp = ServerProxy("https://api.smugmug.com/hack/xmlrpc/1.1.1/",
transport=CURLTransport())
self.api_version = "1.0"
self.api_key = "COZkd1MBtHQtgs0zf2OQ4KTaiIk3ehVs"
self.categories = None
self.subcategories = None
self.login()
self.logout()
def login(self):
rep = self.sp.loginWithPassword(self.account,self.passwo rd,
self.api_version,
self.api_key)
self.session = rep['SessionID']
def logout(self):
self.sp.logout(self.session)
any ideas?
thanks for the help and the script!!
Susan Jones
gymshots
Oct-18-2007, 07:58 PM
I put the script under subversion:
http://sm-photo-tool.sourceforge.net/
Download the release here:
http://sourceforge.net/projects/sm-photo-tool
I went to source forge and downloaded the latest versions, but I don't know what to do with the .rpm and .tar files?
thanks
rutt
Oct-19-2007, 04:39 AM
Oops, you need to have a bunch of curl stuff installed for that curlTransport parameter to work. Just omit it and you will be fine, if a little slower.
Hi Rutt...
I use your tool often (thanks!) and noticed it is broken, too. I tried to make your changes - but when I try to login, I get the following errors below.
(mind you I wrote an extension to your tool that I have been using for over a year, unchanged. It allows me to plug in the photograph ID from the URL and look up the name of my photograph in the command line.)
$ sm_tool.py getFileInfo 193759560
Traceback (most recent call last):
File "/usr/bin/sm_tool.py", line 744, in ?
main()
File "/usr/bin/sm_tool.py", line 735, in main
getInfo(argv[2],Options(argv[3:]))
File "/usr/bin/sm_tool.py", line 672, in getInfo
smugmug = Smugmug(opts.login,opts.password)
File "/usr/bin/sm_tool.py", line 186, in __init__
transport=CURLTransport())
NameError: global name 'CURLTransport' is not defined
here is the fragment of script changes:
class Smugmug:
def __init__(self,account,passwd):
from sys import stderr
# probably don't need to hard code this after all - FIXXME
self.account = account
self.password = password
self.sp = ServerProxy("https://api.smugmug.com/hack/xmlrpc/1.1.1/",
transport=CURLTransport())
self.api_version = "1.0"
self.api_key = "COZkd1MBtHQtgs0zf2OQ4KTaiIk3ehVs"
self.categories = None
self.subcategories = None
self.login()
self.logout()
def login(self):
rep = self.sp.loginWithPassword(self.account,self.passwo rd,
self.api_version,
self.api_key)
self.session = rep['SessionID']
def logout(self):
self.sp.logout(self.session)
any ideas?
thanks for the help and the script!!
Susan Jones
gymshots
Oct-19-2007, 02:25 PM
Thanks, that at least got me logged in. But now I am getting an error in the extension I wrote. I wondered if I could ask for your help a little further....I'm not a strong python programmer....I'll show you the error I am getting and the function I wrote to take the image ID and return the file name....maybe you have an idea....It must be because of the recent changes to the API...
getFileInfo is supposed to take the Image ID and return the file name and album name to the screen.
getInfoFiles works on a file that lists a batch of URLs from smugmug and returns a file with a .out extension where it has decoded the URL into its actual file name and gallery name.
here's the error (to be followed by the script)
$ sm_tool.py getFileInfo 193759560
Traceback (most recent call last):
File "/usr/bin/sm_tool.py", line 745, in ?
main()
File "/usr/bin/sm_tool.py", line 736, in main
getInfo(argv[2],Options(argv[3:]))
File "/usr/bin/sm_tool.py", line 674, in getInfo
smugmug.getInfo_file(image_id,opts,rest)
File "/usr/bin/sm_tool.py", line 358, in getInfo_file
fileInfo = self.sp.getImageInfo(self.session, int(imageId))
File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 4: 'invalid user (missing/incorrect album password)'>
and here is the implementation of getFileInfo
I modified main() to accept two new commands
elif argv[1] == '--help':
Options(argv[1:])
elif argv[1] == 'getFileInfo':
if len(argv) < 2:
Options([]).help()
getInfo(argv[2],Options(argv[3:]))
elif argv[1] == 'getInfoFiles':
if len(argv) < 2:
Options([]).help()
getInfoFiles(argv[2],Options(argv[3:]))
else:
Options([]).help()
and here are the two new methods
def getInfo(image_id,options):
opts = options.options
rest = options.args
smugmug = Smugmug(opts.login,opts.password)
smugmug.getInfo_file(image_id,opts,rest)
def getInfoFiles(imageListFilename,options):
opts = options.options
rest = options.args
smugmug = Smugmug(opts.login,opts.password)
smugmug.getInfo_files(imageListFilename,opts,rest)
and here are the methods called from the smugmug instance
def getInfo_file(self,imageId,opts,rest):
fileInfo = []
fileInfo = self.sp.getImageInfo(self.session, int(imageId))
message(opts,"\n filename is %s\n" % (
fileInfo["FileName"]))
albumInfo = []
albumInfo = self.sp.getAlbumInfo(self.session, fileInfo["AlbumID"])
message(opts,"\n albumTitle is %s\n" % (
albumInfo["Title"]))
def getInfo_files(self,imageFile,opts,rest):
if not path.isfile(imageFile):
raise "ImageFile %s is not a file" % (imageFile)
outputFileName = imageFile + '.out'
fileHandle = open ( outputFileName, 'wa' )
f = file(imageFile,"rU")
try:
option = None
for lwithnl in f:
l = lwithnl[:-1]
imageIndex = string.rfind(l,"#")
if imageIndex == -1:
imageIndex = string.rfind(l,"/")
if imageIndex != -1:
imageIdIndex = imageIndex+1
imageIdString = (l[imageIdIndex:])
fileInfo = []
fileInfo = self.sp.getImageInfo(self.session, int(imageIdString))
message(opts,"Image: %s Filename is %s\n" % (
imageIdString, fileInfo["FileName"]))
albumInfo = []
albumInfo = self.sp.getAlbumInfo(self.session, fileInfo["AlbumID"])
fileHandle.write("%s!%s\n" % (
albumInfo["Title"],
fileInfo["FileName"]))
finally:
fileHandle.close()
f.close()
any help you have to offer is greatly appreciated! I use these all the time for my business....
thanks!
Susan
Oops, you need to have a bunch of curl stuff installed for that curlTransport parameter to work. Just omit it and you will be fine, if a little slower.
wmburke
Feb-10-2008, 03:39 PM
Hello all,
I uploaded several directory trees containing a large number of pictures over the weekend, only to find that on SmugMug only galleries were created, but no images populate them. I have no errors from sm-photo-tool to figure out what's going on. Please help.
I'm running Ubuntu Linux 7.10 with Python 2.5.
Last Friday, I implemented the fix referred to by rutt above to my version 1.10 of the script, including removal of the CurlTransport portion of the fixes - everything seemed to work great and I watched by computer chug away all weekend uploading the files.
I had successfully used the script to upload previously - back in September.
If there's any other info I need to provide, I'll be happy to do so.
Thanks,
Wayne
devbobo
Feb-10-2008, 03:46 PM
Hello all,
I uploaded several directory trees containing a large number of pictures over the weekend, only to find that on SmugMug only galleries were created, but no images populate them. I have no errors from sm-photo-tool to figure out what's going on. Please help.
I'm running Ubuntu Linux 7.10 with Python 2.5.
Last Friday, I implemented the fix referred to by rutt above to my version 1.10 of the script, including removal of the CurlTransport portion of the fixes - everything seemed to work great and I watched by computer chug away all weekend uploading the files.
I had successfully used the script to upload previously - back in September.
If there's any other info I need to provide, I'll be happy to do so.
Thanks,
Wayne
G'day Wayne,
It might be related to the new security measures we implemented, can you please email me your latest script to have a look at ? send it to david at smugmug
Cheers,
David
wmburke
Feb-15-2008, 05:57 PM
Many thanks to Dave Parry for his quick and easy help on solving my issue. He sent me a new copy of the script and all works fine now.
The script that I was using I downloaded from sm-photo-tool.sourceforge.net, and am not sure what the difference is between the two.
Either way, thanks to all for a great tool,
Wayne
rutt
Feb-28-2008, 04:29 PM
Many thanks to Dave Parry for his quick and easy help on solving my issue. He sent me a new copy of the script and all works fine now.
The script that I was using I downloaded from sm-photo-tool.sourceforge.net, and am not sure what the difference is between the two.
Either way, thanks to all for a great tool,
Wayne
Hey, can you guys send a dif or something so I don't have to reinvent it? Thanks.
jmrodri
Apr-14-2008, 07:01 PM
I went to source forge and downloaded the latest versions, but I don't know what to do with the .rpm and .tar files?
thanks
The version in sourceforge was my attempt at putting sm-photo-tool into a source control system to track the changes. I asked rutt if I could do this some time ago.
.rpm and .tar files are for Linux (or Unix variants). If you need it for windows I'm sure I can make sure I generate a zip file for you on sourceforge.
Also, I'm trying to scour this forum for patches that I can import into the sourceforge project.
spencer Lambert
Apr-16-2008, 10:48 AM
Many thanks to Dave Parry for his quick and easy help on solving my issue. He sent me a new copy of the script and all works fine now.
The script that I was using I downloaded from sm-photo-tool.sourceforge.net, and am not sure what the difference is between the two.
Either way, thanks to all for a great tool,
Wayne
I'm also having this same issue. I tried the latest version from sourceforge.net. I even tried the version in the head of the repository - (version 1.13). Can you send me over the file that is working for you?
rutt
Apr-17-2008, 04:52 AM
Hmm. The version I use (which works thanks to David) is very different from the version in sourceforge. My version is available here (http://colortheory.us/my-sm-app.tar.gz). I hope some ambitious soul will merge the best from both versions.
spencer Lambert
Apr-19-2008, 07:51 AM
Hmm. The version I use (which works thanks to David) is very different from the version in sourceforge. My version is available here (http://colortheory.us/sm-app.tar.gz). I hope some ambitious soul will merge the best from both versions.
I get this when I follow your link....
Not Found
The requested URL /sm-app.tar.gz was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
rutt
Apr-20-2008, 07:23 PM
Link fixed now: here (http://colortheory.us/my-sm-app.tar.gz)
jmrodri
Apr-23-2008, 06:27 PM
Hmm. The version I use (which works thanks to David) is very different from the version in sourceforge. My version is available here (http://colortheory.us/my-sm-app.tar.gz). I hope some ambitious soul will merge the best from both versions.
I will be happy to merge the two. I've been maintaining it in sourceforge.
jmrodri
Apr-23-2008, 06:28 PM
Speaking of the sourceforge version, I have released version 1.13 tonight.
Download it here:
http://sourceforge.net/project/showfiles.php?group_id=179298
jmrodri
Apr-23-2008, 06:35 PM
If you have problems with the sm-photo-tool in sourceforge, please file a bug here:
http://sourceforge.net/tracker/?group_id=179298&atid=888591
spencer Lambert
Apr-27-2008, 01:37 PM
Link fixed now: here (http://colortheory.us/my-sm-app.tar.gz)
FYI, this version/file did not fix the issue for me. I'm still having the same issue. It can create the albums and says it's uploading the pictures. The albums show up, but not the photos.
I'm running Fedora Core 5.
rutt
Jun-08-2008, 04:03 AM
Once again this is broken. It fails to authenticate for me. *Sigh* Sorry this is so fragile, but it's hard to keep up with changes in the API.
Is there something we can do to make it more robust?
Dave, thanks in advance for the help.
lccha
Aug-24-2008, 01:55 PM
I've made a few minor patches to the sm-photo-tool v1.13 script. Specifically,
I've added prompting for the login and password. I've also started adding
a few options to the gallery creation.
Where can I submit these? I'm actually considering rewriting the options
processing a bit so that it will be easier to feed a list of options to be processed
as some sort of data structure to avoid having to the large list of "if" statements
in places like create_album. But that might be a project for when I have more
time to think about it.
jmrodri
Sep-01-2008, 05:09 PM
I've made a few minor patches to the sm-photo-tool v1.13 script. Specifically,
I've added prompting for the login and password. I've also started adding
a few options to the gallery creation.
Where can I submit these? I'm actually considering rewriting the options
processing a bit so that it will be easier to feed a list of options to be processed
as some sort of data structure to avoid having to the large list of "if" statements
in places like create_album. But that might be a project for when I have more
time to think about it.
You submitted them to the right place on sourceforge. I'll look at them this week and get them reviewed.
Thanks a bunch.
sincerely,
jesus rodriguez
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.