Hello there,
I'm trying to adapt the cron script to deluged and I came out with this
#!/bin/bash
#
# armbian torrents auto update
#
# download latest torrent pack
TEMP_DIR=$(mktemp -d || exit 1)
chmod 700 ${TEMP_DIR}
trap "rm -rf \"${TEMP_DIR}\" ; exit 0" 0 1 2 3 15
wget -qO- -O ${TEMP_DIR}/armbian-torrents.zip https://dl.armbian.com/torrent/all-torrents.zip
# test zip for corruption
unzip -t ${TEMP_DIR}/armbian-torrents.zip >/dev/null 2>&1
[[ $? -ne 0 ]] && echo "Error in zip" && exit
# extract zip
unzip -o ${TEMP_DIR}/armbian-torrents.zip -d ${TEMP_DIR}/torrent-tmp >/dev/null 2>&1
# create list of current active torrents
deluge-console 'info' | sed '1d; $d' > ${TEMP_DIR}/torrent-tmp/active.torrents
# loop and add/update torrent files
for f in ${TEMP_DIR}/torrent-tmp/*.torrent; do
deluge-console "add ${f}" > /dev/null 2>&1
# remove added from the list
pattern="${f//.torrent}"; pattern="${pattern##*/}";
sed -i "/$pattern/d" ${TEMP_DIR}/torrent-tmp/active.torrents
done
# remove old armbian torrents
while read i; do
[[ $i == *Armbian_* || $i == *gcc-linaro-* || $i == *tar.lz4 ]] &&
deluge-console "rm $(echo "$i" | awk '{print $1}';) --remove_data"
done < ${TEMP_DIR}/torrent-tmp/active.torrents
I'm not sure with the "active.torrents" part because i don't have transmission and i don't know how the informations from the "-l" are listed.
For now the adding part is working and the "active.torrents" file is written!