graveljp / smugcli Goto Github PK
View Code? Open in Web Editor NEWCommand line tool for SmugMug
License: MIT License
Command line tool for SmugMug
License: MIT License
Hi,
I was wondering if it would be possible to add a "quiet/shy" mode so it doesn't ask if you want to proceed with the sync and just does it . Handy if you have sync running as a cron job .
Merci beaucoup
Additional supported video formats can be added to DEFAULT_MEDIA_EXT and VIDEO_EXT (avi, m4v, m4a, mpeg, mpg). Uploads seem to work fine when these are added, although there can still some issues with sync when the files already exist on Smugmug.
Would it be possible to sync deletions/name alterations?
I'd really like to keep a 1:1 match between my local folder and the smugmug destination. Currently this isn't possible. Any previously uploaded content remains on smugmug even if it has been removed from the source.
I realize not everyone would want this behavior, but it would be a good option for those of us who want to achieve a true one way sync.
Thanks so much for this, its really wonderful. I had more than 80G of photos in a menalto gallery that needed moved to smugmug. This worked great.
You should submit this to smugmug so it shows up on their Third party uploaders page.
To do so, it says:
Want to get your app listed on this page? Email [email protected] for approval.
Before:
./smugcli.py sync /absolute/path/to/folderA -t Pics
folderA
will be a subfolder of Pics
Now:
./smugcli.py sync /absolute/path/to/folderA -t Pics
/absolute/path/to/folderA
will be a subfolder of Pics
, which is prone to go over SmugMug limit.
I am syncing a large folder (15k subfolders/galleries and 700k photos).
One thing I have noticed: smugcli
ignores a lot of subfolders (e.g., sync a folder containing 4420 subfolders). I have to rerun the program many times (it still has not fully synced this folder yet) and there is no clues about what happened because of lacking a logging mechanism.
The file extensions are hard-coded and case-sensitive (e.g., Jpg and jpG do not work).
A simple case-insensitive regex would do the job.
I am getting this error when trying to login .
Any clues ?
Started local server.
Visit http://localhost:63983/ to grant SmugCli access to your SmugMug account.
Opening page in default browser...
Traceback (most recent call last):
File "/usr/local/bin/smugcli", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/smugcli/smugcli.py", line 299, in main
run(sys.argv[1:])
File "/usr/local/lib/python3.9/site-packages/smugcli/smugcli.py", line 291, in run
parsed.func(parsed)
File "/usr/local/lib/python3.9/site-packages/smugcli/smugcli.py", line 59, in
login_parser.set_defaults(func=lambda a: fs.smugmug.login((a.key, a.secret)))
File "/usr/local/lib/python3.9/site-packages/smugcli/smugmug.py", line 383, in login
self.config['access_token'] = self.service.request_access_token()
File "/usr/local/lib/python3.9/site-packages/smugcli/smugmug_oauth.py", line 71, in request_access_token
while thread.isAlive():
AttributeError: 'Thread' object has no attribute 'isAlive'
SM has a limit of "5000" on everything: 5000 subfolders per folder, 5000 galleries per folder, 5000 pictures per gallery, etc. Furthermore, it can only contain folder trees that go five folders deep (SmugMug API). It seems smugcli
does not check those limits before uploading, which results in errors or ignoring folders/pictures.
The SM web uploader does check those limits: it does not allow uploading if one of those limits is violated.
I have a pretty good network connection and 6 million photos (yep!) to upload to SM.
Multithreaded uploads would help greatly.
Well, this feature is big and complicated...
Hi There,
I'm using the tool in a batch script file, getting the error below.
Can't figure out why the album creation fails.
Can some of you point me in the right direction?
Thanks in advance!!
"C:\dslrBooth\ontwikkeld\1604-RAY^&\" 1604-RAY& Press any key to continue . . . "1604-RAY^&" 1604-RAY& Press any key to continue . . . ECHO is off. Combined path: Photobooths\2023\1604-RAY& Creating Album "Photobooths\2023\1604-RAY&". Traceback (most recent call last): File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\__main__.py", line 4, in <module> smugcli.main() File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugcli.py", line 310, in main run(sys.argv[1:]) File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugcli.py", line 302, in run parsed.func(parsed) File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugcli.py", line 118, in <lambda> func=lambda a, t=node_type: fs.make_node(a.user, a.path, a.p, t, File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugmug_fs.py", line 167, in make_node self._match_or_create_nodes( File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugmug_fs.py", line 102, in _match_or_create_nodes all_nodes.append(all_nodes[-1].get_or_create_child(dir, params)) File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugmug.py", line 292, in get_or_create_child return self._create_child_node(name, params) File "C:\Users\Bert\AppData\Local\Programs\Python\Python39\lib\site-packages\smugcli\smugmug.py", line 253, in _create_child_node raise UnexpectedResponseError( smugcli.smugmug.UnexpectedResponseError: Error creating node "1604-RAY&". Server responded with status code 409: Conflict. Album not found: "Photobooths\2023\1604-RAY&".
Any ideas? Same error for mkalbum
and mkdir
.
$ smugcli mkalbum --privacy unlisted Family/2021/
Creating Album "Family/2021".
Traceback (most recent call last):
File "/home/firecat53/.local/bin/smugcli", line 8, in <module>
sys.exit(main())
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugcli.py", line 310, in main
run(sys.argv[1:])
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugcli.py", line 302, in run
parsed.func(parsed)
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugcli.py", line 118, in <lambda>
func=lambda a, t=node_type: fs.make_node(a.user, a.path, a.p, t,
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugmug_fs.py", line 167, in make_node
self._match_or_create_nodes(
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugmug_fs.py", line 102, in _match_or_create_nodes
all_nodes.append(all_nodes[-1].get_or_create_child(dir, params))
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugmug.py", line 292, in get_or_create_child
return self._create_child_node(name, params)
File "/home/firecat53/.local/lib/python3.9/site-packages/smugcli/smugmug.py", line 253, in _create_child_node
raise UnexpectedResponseError(
smugcli.smugmug.UnexpectedResponseError: Error creating node "2021".
Server responded with status code 401: The user has not granted the required permissions.
Sync, upload, and ls work great.
I don't know if it matters, but my API key was issued back in 2011. ~/.smugcli shows a v2 endpoint: "authuser_uri": "/api/v2/node/7mTW5" so that may be irrelevant. I'm not sure when the v2 API started, but I think it was quite awhile ago...
For example, I used smugcli to upload 20200703_200206.mp4
and after upload the filename shown on the website is 20200703_200206_mp4.MP4
. This causes both smugcli sync
and uploads from the website to upload the video again because the filename doesn't match.
Thanks!
(sorry to spam you with several issues in a row! Useful project!)
When syncing a folder with both images and subfolders, this program only uploads the images and ignores the subfolders.
The SmugMug web uploader works fine: create a new gallery for the "outside" images and upload the subfolders.
SmugMug stores original copy of image (same hash), but it does mess up with video files.
So, smugcli
will re-upload video files when re-syncing.
Well, I do not know of a solution for this. Maybe just a simple name check for video files?
My workflow is to make SmugMug the master copy of my photos (i.e. I process in Lightroom then create folders and albums on SmugMug. I've been search for a cli tool to sync from SmugMug to my linux box/NAS.
Would it be difficult to extend the code to do this?
Some OSes (Linux at least) allow file/folder names to have space at the end, which would cause an error with SmugMug.
Just trim the names.
Not sure if it's still a work in progress, but installing from source with pip install -e .
fails because smugcli/version.py is missing.
Thanks!
Uploading raw (e.g. DNG or ORF) files works with the "upload" command, but they are ignored when doing a "sync".
SmugMug supports PNG, JPEG, and GIF.
There's an issue with the video file syncing based on the modification times. The threshold is 1 second between modifications times, but I have a lot of files that have been untouched for years and continually get deleted and reuploaded because there's a >1 sec difference between the metadata values grabbed for modification times. There's always that difference, no matter how many times it gets re-uploaded.
In addition, hachoir-metadata is detecting the modification date as 1946 for a number of my video files that have a 2012 date. Other tools like exiftool correctly extract the modification date. Hachoir also is unmaintained and should probably be replaced by another library such as ffmpeg-python.
Hello,
Would it be possible to upload keywords stored in a .json sidecar at the same time as uploading the photo itself?
I would try to do it myself but I have zero knowledge of python.
I manage my photos in Linux with digiKam and I can extract keywords from its database into json sidecars, and I would like to have them in smugmug, too. I checked the API and it seems you can add keywords when you upload a file.
Thanks
I have the following Folder containing Albums on my SmugMug account:
$ smugcli.py ls '2009/04'
Will's Basketball Project
Washington D.C.
5/6 Lax vs Scarsdale
Freshman Lacrosse vs Mahopac
Freshman Lacrosse vs Suffern
Doug warming up
When I try to list the contents of the "5/6 Lax vs Scarsdale" album, I don't see a way to escape the slash:
$ smugcli.py ls '2009/04/5/6 Lax vs Scarsdale'
"5" not found in "/2009/04".
$ smugcli.py ls '2009/04/5\/6 Lax vs Scarsdale'
"5\" not found in "/2009/04".
$ smugcli.py ls "2009/04/5\/6 Lax vs Scarsdale"
"5\" not found in "/2009/04".
$ smugcli.py ls "2009/04/5\\/6 Lax vs Scarsdale"
"5\" not found in "/2009/04".
Any suggestions outside renaming my albums (which is most likely what I am going to end up doing).
It failed to sync many folders when their parent folder has more than 200 entries because of paging (count=100000 does not work. Only returns max 200 entries).
The program is quite nice. Maybe the only one can recursively sync from local to remote for SmugMug. Just need more testing.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.