Skip to content

Automation

Jessy Williams edited this page Jul 8, 2020 · 3 revisions

Getting Started

In addition to operating interactively, mnamer can be configured to run in batch mode, automatically renaming and moving files without used involvement. This can be set using the batch setting. This along with all other settings mentioned here can be set using CLI arguments or config file keys.

Setting Up Your Destination Directories

Your next step will likely be to set your destination directies. This isn't specific to batch mode or necessary but if you're looking to automate file relocation you probably have a destination in mind that you want your files moved to. mnamer uses the movie-directory and episode-directory settings to configure these locations.

Being Adequately Cautious

All of mnamer's settings are available in and out of batch mode but these are particularly recommended to make automation safer-- using them mnamer might not do the right thing but its less likely to do the wrong thing.

  • no-guess prevents guessing using the metadata available from parsing when a file can't be matched against a provider.
  • no-overwrite prevents moving or renaming a file if it will result in overwriting an existing file.

Automation Strategies

Once you have mnamer configured to your liking you need some way to run it. Here are some on working it into your workflow:

Cron

If you are running mnamer on a Linux or Unix based machine then using cron jobs can be an easy way to schedule running mnamer on a given interval. For example, here's a schedule expression to run mnamer every 15 minutes:

*/15 * * * * /home/jkwill87/.local/bin/mnamer --no-guess --no-overwrite -rb /srv/downloads/television /srv/downloads/movies

For those unfamiliar with cron, here's a couple of tips:

  • crontab guru is a helpful tool to properly format your cron expression
  • remember to use the full path to mnamer, which mnamer can be helpful to find it

Docker

You can either build an image from the included Dockerfile or pull it from the Docker Hub.

From there you probably want to mount a directory to /mnt. If the working directory has config file mnamer will use that, otherwise these can be set as part of the command.

Example

Suppose you have some movies in /downloads/movies.

  • docker pull jkwill87/mnamer
  • docker run --rm --volume=/downloads/movies:/mnt jkwill87/mnamer

Other Options

  • Watching a directory using inotifywait
  • If you use a torrent or NZB client it may allow you to run a script after a file is completed.