Création du fichier
This commit is contained in:
27
Scripts/transmission-script.sh
Normal file
27
Scripts/transmission-script.sh
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# script to check for completed torrents and stop and move them
|
||||||
|
|
||||||
|
BLOCKLIST="/var/lib/transmission/.config/transmission-daemon/blocklists/blocklist.bin"
|
||||||
|
# Update blocklist if older than 1 day
|
||||||
|
if [[ $(find "$BLOCKLIST" -mtime +0 -print) ]]; then
|
||||||
|
transmission-remote --blocklist-update
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
TORRENTLIST=`transmission-remote --list | sed -e '1d;$d;s/^ *//' | cut -f1 -d' '`
|
||||||
|
|
||||||
|
for TORRENTID in $TORRENTLIST
|
||||||
|
do
|
||||||
|
TORRENTID=`echo "$TORRENTID" | sed 's:*::'`
|
||||||
|
|
||||||
|
INFO=`transmission-remote --torrent $TORRENTID --info`
|
||||||
|
|
||||||
|
NAME=`echo "$INFO" | grep "Name: *"`
|
||||||
|
DL_COMPLETED=`echo "$INFO" | grep "Percent Done: 100%"`
|
||||||
|
STATE_STOPPED=`echo "$INFO" | grep "State: Stopped\|Finished\|Idle"`
|
||||||
|
|
||||||
|
if [ "$DL_COMPLETED" != "" ] && [ "$STATE_STOPPED" != "" ]; then
|
||||||
|
echo "Removing torrent from list"
|
||||||
|
transmission-remote --torrent $TORRENTID --remove
|
||||||
|
fi
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user