Help with torrenting script

General support for problems installing or using Deluge
Post Reply
senapink
New User
New User
Posts: 1
Joined: Sun Nov 21, 2021 4:53 pm

Help with torrenting script

Post by senapink »

Hi,
I have a script that automatically copy and paste finished torrent download files into a different folder. It has been running fine for past few years but for some reason deluge no longer run it after it finished download in the past week, is there some new change with deluge that im not aware of or is my script faulty? Can you guys take a look?

Code: Select all

#!/bin/bash

torrentId=$1
torrentName=$2
torrentPath=$3
currentDate=`date`

destDir="/home22/naginagi/downloads/to-sync"
tempDir="/home22/naginagi/downloads/temp"

label=$(basename "${torrentPath}")

srcPath="${torrentPath}/${torrentName}"
destPath="${destDir}/${label}/${torrentName}"
destParentPath=$(dirname "${destPath}")

if [ ! "${label}" == "uncategorized" ]
then
	if [ -d "${srcPath}" ]
	then
		destTempPath="${tempDir}/${torrentName}"
		mkdir -p "${tempDir}"
		cp -al "${srcPath}/" "${tempDir}"
		find "${destTempPath}/" -name '*.rar' -execdir unrar x {} \;
		find "${destTempPath}/" -name '*.r??' -exec rm {} \;
		mkdir -p "${destParentPath}"
		mv "${destTempPath}" "${destParentPath}"
		rm -rf "${destTempPath}"
	else
		destTempPath=$(echo "${tempDir}/${torrentName}" | sed -e 's/\.[^.]*$//')
		mkdir -p "${destTempPath}"
		cp -al "${srcPath}" "${destTempPath}"
		find "${destTempPath}/" -name '*.rar' -execdir unrar x {} \;
		find "${destTempPath}/" -name '*.r??' -exec rm {} \;
		mkdir -p "${destParentPath}"
		mv "${destTempPath}/"* "${destParentPath}"
		rm -rf "${destTempPath}"
	fi
	echo "date:${currentDate} - \"${torrentName}\" in \"${srcPath}\" linked to \"${destPath}\" label=${label}" >> /home22/naginagi/scripts/link.log
fi
Thanks in advance
Post Reply