Last active
January 27, 2016 15:00
-
-
Save hazcod/8faa1f6a53339128ef8b to your computer and use it in GitHub Desktop.
Post-process file for sickrage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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