Help with Post-Processing Script - Move based on tracker

Feature requests not specific to either the Mac OS X or GTK+ versions of Transmission
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Help with Post-Processing Script - Move based on tracker

Post by rb07 »

Bad news: the script works fine as is. That means you have a problem with bash, from the looks of it is a very bad, dangerous, problem: looks like memory corruption.

Good news: the original script was good for moving all torrents that belong to a tracker, since you probably only want to use this with one torrent (the one that just finished downloading, and the daemon is actually running the script), then you can use a simplified script:

Code: Select all

#!/bin/sh
#
# Move finished torrent if it comes from TRACKER (see below)

HOST=localhost
PORT=9091
USER=user
PASS=password
TR=/usr/bin/transmission-remote
REMOTE="$TR $HOST:$PORT -n $USER:$PASS"
DESTDIR="/mnt/sda1/download/music"
TRACKER="cyclingtorrents"
LIMIT=1.10
SPEED_LIMIT=100 # kB/s

ID=$TR_TORRENT_ID
$REMOTE -t $ID -it | grep -i "$TRACKER"
if [ $? -eq 0 ]; then
    $REMOTE -t $ID --move "$DESTDIR"
    echo "Moved $ID"
# Bonus: seed indefinitely
    $REMOTE -t $ID --no-seedratio
# Bonus: limit torrents from other trackers
# (actually not needed if 'global seedratio' and 'global upload' are set)
else
  $REMOTE -t $ID --seedratio $LIMIT --uplimit $SPEED_LIMIT
fi
Last edited by rb07 on Tue May 27, 2014 3:25 pm, edited 1 time in total.
radir
Posts: 18
Joined: Sat Apr 18, 2009 4:47 pm

Re: Help with Post-Processing Script - Move based on tracker

Post by radir »

Transmission-remote sends the move command to the daemon, and that's it, it doesn't matter how long it takes to make the actual move, the daemon changes its metainfo an that takes no time.
That's probably true but from a scripting point of view imho checking if location has been updated right after the move command sent is little use. I'd better check if the move happened successfully.

Also my experience is that move is not exactly working as you say but actually tr-remote waits for daemon's response and after a certain time if move has not completed there is a negative response (timeout error), ie. moving large torrents I get the timeout response and not a no time action of updating metadata.

But that's just my experience you may find it differently. Anyhow, script seems to do the job now.
JeanVW14
Posts: 8
Joined: Sat May 24, 2014 11:47 am

Re: Help with Post-Processing Script - Move based on tracker

Post by JeanVW14 »

SUCCESS!!! :D :D :D

Just tested the latest version of the script, and it sorts files from the tracker into the proper directory, while other torrents remain in the unsorted directory.

Rb07, Radir.. Thanks so much for your help!

p.s. Should I be worried about my corrupted memory?
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Help with Post-Processing Script - Move based on tracker

Post by rb07 »

The simplified script can be reduced further, the second if is not really needed (3 lines can be deleted). I've made the changes above.
JeanVW14 wrote:Should I be worried about my corrupted memory?
Yes, but its not "corrupted memory", the problem seems to be that the program bash is corrupting the memory. I would look into installing a newer, or at least a different, version of bash.
gurgle
Posts: 23
Joined: Tue Aug 29, 2006 3:47 am

Re: Help with Post-Processing Script - Move based on tracker

Post by gurgle »

Any way to edit this to move files from multiple trackers to different folders?

Cheers
Post Reply