ebridges / sort-media

Perl script to sort images into a central folder location.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sort-media

Perl script to sync images & videos from Dropbox, extract the date of creation, and rename the media file in a centralized location.

It uses rclone to synchronize the files from the Camera Uploads folder in a Dropbox account.

It is designed to operate under the constraints of a resource-limited NAS, where only Perl is available by default.

The program tries a variety of create-date tags in a specific order, falling back to the last modification date of the file if none of the others are found.

Each copied file is named according to this pattern: ${copy-destination}/yyyy-MM-DD/yyyyMMDDTHHmmss_nn.typ

(nn is a serial number that is there to avoid duplicate name clashes. See here for details).

Setup

Before this can be used, rclone must be authorized to work with a Dropbox account:

$ rclone config

Usage

To run the script execute it with the name of the account configured above:

$ ./sbin/sync-photos.pl ebridges

Configuration

  • Managed in file etc/config.ini

  • Configuration Parameters

logging-config
Location of log4perl configuration file.
local-directory
Location where remote files will be sync'd to.
remote-directory
Remote location where files will be sync'd from.
copy-image-destination
Location where images are copied to.
copy-video-destination
Location where videos are copied to.
includes-file
Filename extensions of files that should be copied from the remote-directory.
rclone-bath
Path (either relative or absolute> to the `rclone` binary.
remove-remote-files
Remove remote files after successfully processing
purge-local-dir
Clean up local sync dir after running.

Environment

  • Specified in file profile

  • Variables

PERL5LIB
Specifies where the scripts modules are.
PATH
Appends the bin folder to the executable path.
IMGSORTER_ENV
Specifies the section of the config to pull from -- either `DEVELOPMENT` (default if absent) or `PRODUCTION`

To Do

  • Add support for copying videos that have an associated THM metadata file.
  • Remove functionality here which adjusts photos taken during an extended period of time where our camera had the wrong date.

About

Perl script to sort images into a central folder location.


Languages

Language:Perl 96.5%Language:Shell 3.5%