Skip to content

Instantly share code, notes, and snippets.

@hazcod
Last active January 27, 2016 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hazcod/8faa1f6a53339128ef8b to your computer and use it in GitHub Desktop.
Save hazcod/8faa1f6a53339128ef8b to your computer and use it in GitHub Desktop.
Post-process file for sickrage
#!/bin/bash
#set -e
#set -x
move_to="/home/nindustries/data/acd/series"
inputpath="$1"
IFS='/'; read -ra ARR <<< "$inputpath"
seasonpath=$(dirname "$inputpath")
showname=${ARR[6]}
season=${ARR[7]}
if [ -z "$(acdcli ls /series | grep "$showname")" ]; then
acdcli mkdir "/series/$showname"
acdcli upload -o "$seasonpath/../tvshow.nfo" "/series/$showname/tvshow.nfo"
fi
if [ -z "$(acdcli ls "/series/$showname" | grep "$season")" ]; then
acdcli mkdir -p "/series/$showname/$season"
fi
filename=$(basename "$inputpath")
filename_no_ext="${filename%.*}"
for file in "$seasonpath/$filename_no_ext"*; do
acdcli upload --max-retries 5 --remove-source-files -f "$file" "/series/$showname/$season/"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment