Skip to main content

Monitor a given number of inbox directories for files by mime type

Project description

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.

For example, with the following configuration file:

{
  "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",
    "handler": "shotfirst.handlers.pdf_handler",
    "mask": "%Y/%m"
  }
}

shotfirst will:

  1. Copy all GIF, JPEG, and PNG images found in the given folders to a directory /tmp/foo/pics and will use the EXIF metadata from the image to figure out the sub-folder structure (which is year/month/day)

  2. Move all the WebM videos in the given folders to a directory named /tmp/foo/videos based on the video metadata, if available. Otherwise will fall back to the file system meta data.

  3. Copy all PDF files in the given folders to a directory /tmp/foo/docs based on the PDF metadata if available. Fall back to the file system meta data if not.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shotfirst-0.10.tar.gz (6.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page