Currently I have couchpotato and sabnzbd working well on my system. Headphones and sickbeard don't work but I want to sort out the two working first.
The only thing remaining is a script that will move the completed files fro the download folder to the drive I have set aside specifically for media.
This was just beyond my understanding: Transmission - Script to move completed downloads to directories, or how to create script? and what confused me was do I have to find the id all the time - one by one? Thing is I want to move them after they have finished so I want to write the script and run it as a scheduled job which I kind of assumed is a cron job in the backend.
I saw this script on the internet but the developer did not put a description or guide. Just dropped it for the guy and I suppose both understood what they were doing but it is way too complicated for my level.
cd "$FOLDER_PATH"
####################
# Movie Processing #
####################
if [ $CATEGORY_NAME = "movies" ]
then
# Where do you want to put the movies that this script processes?
MOVIE_DESTINATION_DIRECTORY=" /media/6f1b1b52-a404-4bb7-a249-382b25b75801/Movies/"
MOVIE_NAME=`echo $FOLDER_NAME | sed 's/ (.*)//g'`
echo "Movie Name: $MOVIE_NAME" >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
if [ `find . -size +629145600c -regex '.*/.*\.avi' | wc -l` -eq 2 ]
then
FILEZ[1]="$FOLDER_PATH`find . -size +629145600c -regex '.*/.*\.avi' | sort | sed -n '1p' | sed 's/^\.//'`"
FILEZ[2]="$FOLDER_PATH`find . -size +629145600c -regex '.*/.*\.avi' | sort | sed -n '2p' | sed 's/^\.//'`"
echo "Joining Files..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
mencoder -forceidx -ovc copy -oac copy -o "$FOLDER_PATH/$MOVIE_NAME".avi "${FILEZ[1]}" "${FILEZ[2]}"
#Get the path for the avi
FILEZ[1]="$FOLDER_PATH`find . -size +629145600c -regex '.*/.*\.avi' | sed 's/^\.//'`"
echo "Making Folder..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
#Make Folder for the avi
mkdir "$MOVIE_DESTINATION_DIRECTORY/$MOVIE_NAME"
echo "Moving Files..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
#Move the avi to the folder
mv "$FOLDER_PATH/$MOVIE_NAME.avi" "$MOVIE_DESTINATION_DIRECTORY/$MOVIE_NAME/$MOVIE_NAME.avi"
#If there's an nfo, move that into the folder as well
if [ `find . -regex '.*/.*\.nfo' | wc -l` -gt 0 ]
then
FILEZ[2]="$FOLDER_PATH`find . -regex '.*/.*\.nfo' | sed 's/^\.//'`"
mv "${FILEZ[2]}" "$MOVIE_DESTINATION_DIRECTORY/$MOVIE_NAME/$MOVIE_NAME.nfo"
chmod 777 -R "${MOVIE_DESTINATION_DIRECTORY}"/"${MOVIE_NAME}"
fi
rm -r "$FOLDER_PATH"
echo "Removing Folder: $FOLDER_NAME..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
else
if [ `find . -size +629145600c -regex '.*/.*\.avi' | wc -l` -eq 1 ]
then
#Get the path for the avi
FILEZ[1]="$FOLDER_PATH`find . -size +629145600c -regex '.*/.*\.avi' | sed 's/^\.//'`"
echo "Making Folder..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
#Make Folder for the avi
mkdir "$MOVIE_DESTINATION_DIRECTORY/$MOVIE_NAME"
echo "Moving Files..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
#Move the avi to the folder
mv "${FILEZ[1]}" "$MOVIE_DESTINATION_DIRECTORY/$MOVIE_NAME/$MOVIE_NAME.avi"
#If there's an nfo, move that into the folder as well
if [ `find . -regex '.*/.*\.nfo' | wc -l` -gt 0 ]
then
FILEZ[2]="$FOLDER_PATH`find . -regex '.*/.*\.nfo' | sed 's/^\.//'`"
mv "${FILEZ[2]}" "$MOVIE_DESTINATION_DIRECTORY/$MOVIE_NAME/$MOVIE_NAME.nfo"
chmod 777 -R "${MOVIE_DESTINATION_DIRECTORY}"/"${MOVIE_NAME}"
fi
rm -r "$FOLDER_PATH"
echo "Removing Folder: $FOLDER_NAME..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
else
echo "Couldn't copy(too many files or no files?)" >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
fi
fi
fi
#################
# TV Processing #
#################
if [ $CATEGORY_NAME = "TV" ]
then
echo "Beginning TV Processing..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
##Where is your root TV directory? This script will create folders in it, i.e. ROOT_TV/Seinfeld/Season 8/...
TV_DESTINATION_DIRECTORY=" /media/6f1b1b52-a404-4bb7-a249-382b25b75801/TV Shows"
if [ `echo $FOLDER_NAME | awk -F " - " '{print NF}'` -ne 3 ]
then
echo "Folder name incorrect, quitting..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
exit 0
fi
OPT_NAME=`echo $FOLDER_NAME | sed 's/ (.*)//g'`
SHOW_NAME=`echo $OPT_NAME | awk -F " - " '{print $1}'`
echo "Show Name: $SHOW_NAME" >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
SEASON_NUMBER=`echo $OPT_NAME | awk -F " - " '{print $2}' | awk -F "x" '{print $1}'`
echo "Season Number: $SEASON_NUMBER" >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
EPISODE_NUMBER=`echo $OPT_NAME | awk -F " - " '{print $2}' | awk -F "x" '{print $2}'`
if [ `find . -size +73400320c -regex '.*/.*\.avi' | wc -l` -eq 1 ]
then
FILEZ[1]="$FOLDER_PATH`find . -size +73400320c -regex '.*/.*\.avi' | sed 's/^\.//'`"
echo "One file found, making directories..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
mkdir "$TV_DESTINATION_DIRECTORY/$SHOW_NAME"
mkdir "$TV_DESTINATION_DIRECTORY/$SHOW_NAME/Season $SEASON_NUMBER"
echo "Moving File..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
mv "${FILEZ[1]}" "$TV_DESTINATION_DIRECTORY/$SHOW_NAME/Season $SEASON_NUMBER/$OPT_NAME.avi"
echo "Removing Folder..." >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
chmod 777 -R "${TV_DESTINATION_DIRECTORY}"/"${SHOW_NAME}"
rm -r "$FOLDER_PATH"
else
echo "Couldn't copy(too many files or no files?)" >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
fi
echo "Done!" >> /home/USERNAME/.sabnzbd/logs/sab_proc.log
fi
If someone can help me customise it, I will be grateful.
My sabnzbd folders are as follows:
Temporary Download Folder:
Completed Download Folder:
Watched Folder:
My permissions is 777 so pretty much anybody can write into it so there shouldn't be any permissions issues.
Please can anybody help with using above script or sharing their script with instructions.
The TV processing part was ok for me to customise but the movie section just threw me.
Coding just floors me if it is too complex.
Can anyone assist?
Thanks