Overview
This is just a very simple inotify monitor for “dropbox” style folders. What it does is you give it a JSON config file and some directories and it will go and find all the files in the directories and execute shutil operations on them (by default copy2 which means the file is copied along with the metadata) to the configured location.
Installing
Option 1: Clone this repo and pip install . (bleeding edge)
Option 2: Run pip install shotfirst (released)
Configuration
With the following configuration file shotfirst.json:
{
"image/jpeg, image/gif, image/png": {
"mask": "%Y/%m/%d",
"target": "/tmp/foo/pics",
"handler": "shotfirst.handlers.exif_image_handler"
},
"video/webm": {
"target": "/tmp/foo/videos",
"operation": "move",
"mask": "%Y/%m/%d",
"handler": "shotfirst.handlers.video_handler"
},
"application/pdf": {
"target": "/tmp/foo/docs",
"operation": "movereplace",
"handler": "shotfirst.handlers.pdf_handler",
"mask": "%Y/%m"
}
}
shotfirst shotfirst.json /tmp/inbox will:
Monitor the /tmp/inbox folder for files
Copy all GIF, JPEG, and PNG images found to a directory /tmp/foo/pics and use the EXIF metadata from the image to figure out the sub-folder structure (which is year/month/day)
Move all the WebM videos to a directory named /tmp/foo/videos based on the video metadata, if available. Otherwise will fall back to the file system meta data.
Copy all PDF files to a directory /tmp/foo/docs based on the PDF metadata if available. If the file was somehow imported previously, overwrite with the newly discovered file
Running in a container
There’s a published container image, to run you will have to mount your configuration file and your input and output folders, for example:
podman run --rm -it -v `pwd`/myconfig:/etc/shotfirst.json -v `pwd`/input:/inbox:rw -v `pwd`/output:/outbox:rw thekad/shotfirst:latest
And adjust your configuration appropriately to output the files to subdirectories under /outbox.
If you want to monitor multiple directories, you can mount them as volumes and then set the SDIRS environment variable, like this:
podman run --rm -it -v /opt/dropbox1:/inbox1 -v /opt/dropbox2:/inbox2 -e SDIRS="/inbox1 /inbox2" thekad/shotfirst:latest
Metadata
Release files for shotfirst 0.12.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shotfirst-0.12.3.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shotfirst-0.12.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / shotfirst-0.12.3.tar.gz
| Download URL | shotfirst-0.12.3.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fafdd0e00841df2dece5eb34c8ff8a7ed68143741f0bf3851f2fee0d0ff3b6a
|
|
BLAKE2b-256 checksum How to use checksums |
a0a2c41fc9cc40f0b25c5984566f5d51ef1cea47357e518cc4613c9e482eb169
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.14 Linux/5.4.109+
|
Release files / shotfirst-0.12.3-py3-none-any.whl
| Download URL | shotfirst-0.12.3-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8817f0d14b65f7c5b15f2a82ac143c13c62e7a9e9d9d4572efa30fa11b498e4
|
|
BLAKE2b-256 checksum How to use checksums |
d00203a692af197234db54c2fd9f7bef5c9cce0dd378523cf455a31f93e4f664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.14 Linux/5.4.109+
|