Skip to content

Commit

Permalink
Fix installation and usage instructions in README.md
Browse files Browse the repository at this point in the history
On Windows, it's safer to install Python from the official installer
rather than from the Microsoft Store. Then, Smugcli should be used via
the `smugcli` binary.
  • Loading branch information
graveljp committed Feb 2, 2025
1 parent 2ce5b2d commit 8982e1e
Showing 1 changed file with 38 additions and 20 deletions.
58 changes: 38 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,86 @@ Tested with Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13.

# Installation

Smugcli is written in [Python](https://www.python.org/) and is distributed via the [Pip](https://pypi.org/project/pip/) package manager. To install smugcli, first [install a Python 3](https://www.python.org/downloads/) distribution on your system (Python 2 is not supported). Pip is usually installed automatically, [install it manually](https://pip.pypa.io/en/stable/installation/) if it isn't. Then, install smugcli by running:
```
Smugcli is written in [Python](https://www.python.org/) and is distributed via
the [Pip](https://pypi.org/project/pip/) package manager. To install smugcli,
first [install a Python 3](https://www.python.org/downloads/) distribution on
your system (Python 2 is not supported). On windows, install Python using the
official installer from the [Python web site](https://www.python.org/downloads/
), not the version found on the Microsoft Store (this version doesn't correctly
configure the PATH environment variable).

Pip is usually installed automatically, [install it manually](
https://pip.pypa.io/en/stable/installation/) if it isn't. Then, install smugcli
by running:
```shell
pip install smugcli
```
or, if `pip` can't be found, try:
```
or, if `pip` can't be found, try either:
```shell
python -m pip install smugcli
```
or:
```
python3 -m pip install smugcli
```

If you get a warning saying that `smugcli` was installed in a folder that is not
in your `PATH`, you might need to add that folder to the `PATH` environment
variable manually.

# Sample usage

To use this command line tool, you will need to request your own API key by
visiting https://api.smugmug.com/api/developer/apply. Using your key and secret,
log into smugcli using the following command:
```
$ ./smugcli.py login --key=<key> --secret=<secret>
$ smugcli login --key=<key> --secret=<secret>
```

This is a one time operation. From this point on, smugcli will be able to access
your SmugMug account. To logout, run the command: `$ ./smugcli.py logout`
your SmugMug account. To logout, run the command: `$ smugcli logout`

You can list the content of your SmugMug account by doing:
```
$ ./smugcli.py ls
$ smugcli ls
Photography
Portfolio
Other
$ ./smugcli.py ls Photography
$ smugcli ls Photography
2014
2015
2016
$ ./smugcli.py ls Photography/2015
$ smugcli ls Photography/2015
Photoshoot with Dave
```

Note that smugcli can also be used to access other public SmugMug account by
using the `--user` argument:
```
$ ./smugcli.py ls -u <username>
$ smugcli ls -u <username>
```

Folders can be created by using the `mkdir` command:
```
$ ./smugcli.py mkdir Photography/2017
$ smugcli mkdir Photography/2017
```

Similarly, albums can be created by doing:
```
$ ./smugcli.py mkalbum 'Photography/2017/My new album'
$ smugcli mkalbum 'Photography/2017/My new album'
```

To upload photos to an album, run:
```
$ ./smugcli.py upload local/folder/*.jpg 'Photography/2017/My new album'
$ smugcli upload local/folder/*.jpg 'Photography/2017/My new album'
```

Finally, the nicest feature of all, you can synchronize a whole local folder
hierarchy to your SmugMug account using the `sync` command:
```
$ ./smugcli.py sync local/folder remote/folder
$ smugcli sync local/folder remote/folder
Creating Folder "remote/folder/2015".
Creating Album "remote/folder/2015/2015-08-03, Mary's Wedding".
Uploading "local/folder/2015/2015-08-03, Mary's Wedding/DSC_0001.JPG"
Expand All @@ -98,15 +116,15 @@ be re-uploaded.
Multiple sources can be synced in the same operation, the last argument being
the destination folder and the others being the sources:
```
$ ./smugcli.py sync 2016 2017 2018 remote/folder
$ smugcli sync 2016 2017 2018 remote/folder
Syncing:
2016
2017
2018
to SmugMug folder "remote/folder"',
...
$ ./smugcli.py sync 201* remote/folder
$ smugcli sync 201* remote/folder
...
```

Expand All @@ -122,7 +140,7 @@ The sync command uses multiple threads to speed-up the file scanning and upload.
You may want to tune the number of threads used by SmugCLI depending on your
machine's performance. For instance:
```
$ ./smugcli.py sync local/folder remote/folder --folder_threads=4 --file_threads=8 --upload_threads=2
$ smugcli sync local/folder remote/folder --folder_threads=4 --file_threads=8 --upload_threads=2
```

`folder_threads` control the number of album folders that are processed in
Expand All @@ -138,17 +156,17 @@ resources.
When you are happy with the performance using certain thread counts, you may
save these preferences so that they'd be used as defaults next time:
```
$ ./smugcli.py sync --set_defaults --folder_threads=4 --file_threads=8 --upload_threads=2
$ smugcli sync --set_defaults --folder_threads=4 --file_threads=8 --upload_threads=2
```

To exclude paths from the sync operation, run the command:
```
$ ./smugcli.py ignore local/folder/export-tmp
$ smugcli ignore local/folder/export-tmp
```

To undo this operation, you can run:
```
$ ./smugcli.py include local/folder/export-tmp
$ smugcli include local/folder/export-tmp
```

# Contributions
Expand Down

0 comments on commit 8982e1e

Please sign in to comment.