~travisshears/folder-pics

A cli app that watches folders for images and automatically transforms them.
cfb15170 — Travis Shears 3 years ago
add launchd configs
02adea0d — Travis Shears 4 years ago
update README.md
b821a456 — Travis Shears 4 years ago
add video to README.md

clone

read-only
https://git.sr.ht/~travisshears/folder-pics
read/write
git@git.sr.ht:~travisshears/folder-pics

You can also use your local clone with git send-email.

#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.

Sorry, your browser doesn't support embedded videos.

#How to install

#via brew

The project is available for OSX via brew:

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

#from source

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

#via crates.io

If you already have rust you should be able to

$ cargo install folderpics

#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.

#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