#watcher #cli #imagemagik

app folderpics

A cli app that watches folders for images and automatically transforms them

1 unstable release

0.4.0 Sep 13, 2020

#31 in #watcher

MIT license

12KB
133 lines

Folder Pics

ImageMagik utility to resize images automatically based on watched directories. It will resize to a size specified in the config and convert to .jpg for smaller file size.

How to install

The project is available for OSX via brew:

$ brew tap travisshears/tap https://git.sr.ht/\~travisshears/homebrew-tap
$ brew install folderpics
folderpics

If you have rust it is also possible to clone this repo and install from source.

How to config

The app relies on a config file, ~/.folder_pics.yml, in your home directory. The config file tells the app which folders to watch for changes, which size to transform the images into, and where to output the images.

Here is an example .folder_pics.yml:

sources:
  - source_path: "/Users/t.shears/Pictures/resize/450"
    dest_patth: "/Users/t.shears/Pictures/resize/450/small"
    size: 450
  - source_path: "/Users/t.shears/Pictures/resize/900"
    dest_patth: "/Users/t.shears/Pictures/resize/900/small"
    size: 900

note: the dest_paths need not be nested they can be where ever on your disk just make sure you have write permissions.

Running the app

I've envisioned three main ways to run the app.

A. Test it out temporally by leaving it running in a terminal somewhere.

For example if you are using tmux you can just leave a pane/window with it running and leave it be for the day.

B. Run it the background but start the background process manually.

Similar to leaving it running in terminal but this will survive on without the terminal.

ex:

$ nohup folderpics >> /tmp/folderpics.log &

note: this process won't close when you close the terminal thanks to nohup and will be running in the background thanks to the trailing &

To stop it later run ps aux | grep folderpics find the process id then kill -9 P_ID

C. Run it in the background with auto start on launch and keepalive via launchd

Running in the background seems to take .02% of my macs cpu. Seems fine to leave it running forever.

Instructions coming soon once I figure this out myself.

Licence

Learn more about the Licence at https://anticapitalist.software/

Dev

Bump version

Right now this is a manual process because bumpversion was having problems parsing the string in Config.toml. Make sure to update:

  • ./Config.toml
  • ./Cargo.lock
  • ./src/main.rs

Dependencies

~3–12MB
~137K SLoC