Skip to main content

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:

  1. Monitor the /tmp/inbox folder for files

  2. 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)

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

  4. 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)

Source distribution for shotfirst 0.12.3
File Size Uploaded
shotfirst-0.12.3.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shotfirst 0.12.3
File Interpreter ABI Platform
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+

Release history Release notifications | RSS feed

This release

0.12.3 This release

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.10

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page