Skip to content

Instantly share code, notes, and snippets.

@yuriteixeira
Last active December 17, 2015 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yuriteixeira/5605090 to your computer and use it in GitHub Desktop.
Save yuriteixeira/5605090 to your computer and use it in GitHub Desktop.
Filebot AMC (Automated Media Center) Helper
#!/bin/bash
if [ $1 ] && [ $1 == '-h' ]
then
echo ""
echo "Welcome to Filebot AMC (Automated Media Center) Script."
echo ""
echo "Usage: filebot-amc.sh [torrent_name] [/path/to/torrent] [/path/to/media] [/path/to/log]"
echo ""
echo "NOTES: "
echo "1. Arguments [torrent_name] and [/path/to/torrent] if this is script is by Transmission Bittorrent Client post-download hook."
echo "2. Arguments [/path/to/media] and [/path/to/log] are optional if you set defaults values changing this script"
echo ""
exit
fi
# Torrent Name
if [ $1 ]
then
TR_NAME=$1
else
TR_NAME=$TR_TORRENT_NAME
fi
# Torrent Dir
if [ $2 ]
then
TR_DIR=$2
else
TR_DIR=$TR_TORRENT_DIR
fi
# Target Media Dir
if [ $3 ]
then
TARGET_DIR=$3
else
TARGET_DIR="/Volumes/YURI-STRG/Media/"
fi
# Log Path
if [ $4 ]
then
LOG_PATH=$4
else
LOG_PATH="/Users/yuri/Desktop/filebot_amc.log"
fi
echo "TR_DIR=$TR_DIR"
echo "TR_NAME=$TR_NAME"
echo "TARGET_DIR=$TARGET_DIR"
echo "LOG_PATH=$LOG_PATH"
### If all params are set, go on ###
if [ $TR_DIR ] && [ $TR_NAME ] && [ $TARGET_DIR ] && [ $LOG_PATH ]
then
/Applications/Filebot.app/Contents/MacOS/filebot \
-script fn:amc \
--output "$TARGET_DIR" \
--log-file "$LOG_PATH" \
--action move \
--conflict override -non-strict \
--def subtitles=pt,en music=n artwork=n clean=y "ut_dir=$TR_DIR/$TR_NAME" "ut_kind=multi" "ut_title=$TR_NAME"
else
echo "PROBLEM: Please, set all arguments needed. Use -h option to get help about it."
echo ""
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment