Script after download

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
tocks
Posts: 4
Joined: Thu Dec 08, 2016 9:04 am

Script after download

Post by tocks »

Hello,

I want to execute a script after download a torrent.

I want that this script copy de *.torrent in a other directory.

i update my /etc/transmission-daemon/settings.json

Code: Select all

"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/home/user/script.sh",
but, how i can find the path of the *.torrent ?

Thanks
tocks
Posts: 4
Joined: Thu Dec 08, 2016 9:04 am

Re: Script after download

Post by tocks »

it's my script. But the log file don't create.

Code: Select all

#!/usr/bin/env bash
# Transmission script to move files to post-processing


#################################################################################
# These are inherited from Transmission.                                        #
# Do not declare these. Just use as needed.                                     #
#                                                                               #
# TR_APP_VERSION                                                                #
# TR_TIME_LOCALTIME                                                             #
# TR_TORRENT_DIR                                                                #
# TR_TORRENT_HASH                                                               #
# TR_TORRENT_ID                                                                 #
# TR_TORRENT_NAME                                                               #
#                                                                               #
#################################################################################


#################################################################################
#                                    CONSTANTS                                  #
#                         configure directories and filetypes                   #
#################################################################################


# Use recursive hardlinks (cp -al) only if both Transmission's seed dir and 
# the final dir belong to the same filesystem.  Set to false to make a 
# duplicate copy. Note: true allows you to seed and copy without using up 
# twice the storage.
HARDLINKS=true

# The file for logging events from this script
LOGFILE="/data/02-Torrent/01-Torrent/90-Seedbox-6-transmission/transmission-complete.log"

#################################################################################
#                                 SCRIPT CONTROL                                #
#                               edit with caution                               #
#################################################################################


function edate 
{
  echo "`date '+%Y-%m-%d %H:%M:%S'`    $1" >> "$LOGFILE"
}
How to know if the script is executed ?

Thanks
tocks
Posts: 4
Joined: Thu Dec 08, 2016 9:04 am

Re: Script after download

Post by tocks »

thanks for your relpy

I update my script to this :

Code: Select all

#!/usr/bin/env bash
# Transmission script to move tiorrent files to post-processing


#################################################################################
# These are inherited from Transmission.                                        #
# Do not declare these. Just use as needed.                                     #
#                                                                               #
# TR_APP_VERSION                                                                #
# TR_TIME_LOCALTIME                                                             #
# TR_TORRENT_DIR                                                                #
# TR_TORRENT_HASH                                                               #
# TR_TORRENT_ID                                                                 #
# TR_TORRENT_NAME                                                               #
#                                                                               #
#################################################################################


#################################################################################
#                                    CONSTANTS                                  #
#                         configure directories and filetypes                   #
#################################################################################


# Use recursive hardlinks (cp -al) only if both Transmission's seed dir and 
# the final dir belong to the same filesystem.  Set to false to make a 
# duplicate copy. Note: true allows you to seed and copy without using up 
# twice the storage.
HARDLINKS=true

# The file for logging events from this script
LOGFILE="/data/02-Torrent/01-Torrent/90-Seedbox-6-transmission/transmission-complete.log"



#################################################################################
#                                 SCRIPT CONTROL                                #
#                               edit with caution                               #
#################################################################################


function edate 
{
  echo "`date '+%Y-%m-%d %H:%M:%S'`    $1" >> "$LOGFILE"
 
}


edate "__________________________NEW TORRENT FINI _______________________"
edate "Version de transmission $TR_APP_VERSION"
edate "Time  $TR_TIME_LOCALTIME"
edate "Directory is $TR_TORRENT_DIR"
edate "Torrent Hash is $TR_TORRENT_HASH"
edate "Torrent ID is $TR_TORRENT_ID"
edate "Torrent name is $TR_TORRENT_NAME "

and now with you link, my script is execute.

Code: Select all

2016-12-13 06:24:37    __________________________NEW TORRENT FINI _______________________
2016-12-13 06:24:38    Version de transmission 2.92
2016-12-13 06:24:38    Time Tue Dec 13 06:24:36 2016
2016-12-13 06:24:38    Directory is /data/02-Torrent/90-Archives
2016-12-13 06:24:39    Torrent Hash is 2d8ca1982b6fd2298deb3d8891ba0dfb7e0f64a9
2016-12-13 06:24:39    Torrent ID is 3372
2016-12-13 06:24:39    Torrent name is ubuntu  amd64 full 
i see all my *.torrents in /var/lib/transmission-daemon/info/torrents

But with the variables I have. I do not see how I can have the complete path of the .torrent to copy it to another directory ?

Thanks
tocks
Posts: 4
Joined: Thu Dec 08, 2016 9:04 am

Re: Script after download

Post by tocks »

Ho, i test this

the original torrent file is ;
debian 8.6.0 amd64 netinst.iso-4262625.torrent
The file in my whatdir :
ls -l | grep debian
-rwxrwxrwx 1 1024 users 20183 déc. 13 20:47 debian 8.6.0 amd64 netinst.iso-4262625.torrent.added
Result of the script :
2016-12-13 21:00:02 __________________________NEW TORRENT FINI _______________________
2016-12-13 21:00:03 Version de transmission 2.92
2016-12-13 21:00:03 Je sais pas Tue Dec 13 20:59:58 2016
2016-12-13 21:00:03 Directory is /data/02-Torrent/90-Archives_Apollo
2016-12-13 21:00:03 Torrent Hash is 6c4af38bc6004ca80d0216296a6e451387e73993
2016-12-13 21:00:03 Torrent ID is 4829
2016-12-13 21:00:03 Torrent name is debian-8.6.0-amd64-netinst.iso
in my /var/lib/transmission-daemon/info/torrents
debian-8.6.0-amd64-netinst.iso.6c4af38bc6004ca8.torrent
There is a part of the hash.

But with what command can I recover the path by making a string match?

you can help me on this ?

Thanks
Post Reply