I find the software FileBot to be quite useful for automatically renaming media files, for non-nefarious purposes, of course. Getting it set up on my macOS system took a bit of work, so I’m documenting it here.

Setup

I used Homebrew to install it with the following command.

brew cask install filebot --force --appdir=~/Applications

There are prerequisites (command line tools for Xcode, Java, etc.), so see the full instructions here.

A license file is required. Do not buy the Mac App Store version, which is GUI-only! Instead, go here and purchase the annual subscription (six bucks, annually) for the “universal license” per this thread. It includes the GUI and also the command line interface (CLI) version, which is what I use.

The .psm license file is sent via email I stored mine in ~/code/filebot-stuff. To activate your copy, navigate to the directory in which your .psm resides and execute the following command.

filebot --license *.psm

This registers things all up.

Usage

Manually, I use two commands. To rename all media files (and directories containing them via the --def target=folder option), use the following command, which applies to everything in the current directory.

filebot -rename --def target=folder ./*

To get English subtitles, when applicable, the following apples to everything in the current directory.

filebot -get-subtitles ./*

Automating with Transmission

Set up Transmission to apply this to every file after the download finishes via these instructions, which essentially say to go to Transmission’s Preferences > Transfers > Management and tick Call script: When download completes and point it to the transmission-postprocess.sh bash script, which I also placed in ~/code/filebot-stuff. I modified it slightly, as follows.

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$TR_TORRENT_DIR/$TR_TORRENT_NAME"
ARG_NAME="$TR_TORRENT_NAME"
ARG_LABEL="N/A"

# Configuration
CONFIG_OUTPUT="$HOME/_to_nas"

/usr/local/bin/filebot -script fn:amc \
  --output "$CONFIG_OUTPUT" \
  --action duplicate \
  --conflict skip \
  -non-strict \
  --log-file /Users/picone/code/filebot-stuff/transpp.log \
  --def unsorted=y \
  music=y \
  artwork=y \
  excludeList=".excludes" \
  ut_dir="$ARG_PATH" \
  ut_kind="multi" \
  ut_title="$ARG_NAME" \
  ut_label="$ARG_LABEL"

Note that I also log to the same directory. Note that the output directory must exist or the process fails (it won’t create $HOME/_to_nas in the code above).