Call script when download complete environment variables

Feature requests not specific to either the Mac OS X or GTK+ versions of Transmission
Post Reply
LoveLoveMeDoYouKnow
Posts: 4
Joined: Tue Apr 21, 2009 8:44 pm

Call script when download complete environment variables

Post by LoveLoveMeDoYouKnow »

The "Call script when download complete " new feature in 2.13 is great. I would like to write a script that copies the downloaded file to another location.
However the environment variables for the script do no supply information about the downloaded file.

How about adding TR_DOWNLOADED_PATH variable with the full path to the finished downloaded file or folder?

thanks,
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Call script when download complete environment variables

Post by Jordan »

That's not a bad idea. Could you open a trac ticket for that? List it as a libtransmission enhancement, and please milestone it for 2.20, and add a link back to this forum thread.
gunzip
Posts: 272
Joined: Wed May 05, 2010 2:12 am

Re: Call script when download complete environment variables

Post by gunzip »

LoveLoveMeDoYouKnow wrote:How about adding TR_DOWNLOADED_PATH variable with the full path to the finished downloaded file or folder?
isn't that in effect already included in the present env variables TR_TORRENT_DIR and TR_TORRENT_NAME

Code: Select all

TR_DOWNLOADED_PATH="$TR_TORRENT_DIR/$TR_TORRENT_NAME"
or maybe things are different between linux and a mac?
LoveLoveMeDoYouKnow
Posts: 4
Joined: Tue Apr 21, 2009 8:44 pm

Re: Call script when download complete environment variables

Post by LoveLoveMeDoYouKnow »

isn't that in effect already included in the present env variables TR_TORRENT_DIR and TR_TORRENT_NAME
TR_TORRENT_NAME is the name of the torrent, not the name of the file(s) downloaded using the torrent.
In order to be able to copy the file(s) that were downloaded, I would need the path to the file(s).
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Call script when download complete environment variables

Post by Jordan »

gunzip wrote:
LoveLoveMeDoYouKnow wrote:isn't that in effect already included in the present env variables TR_TORRENT_DIR and TR_TORRENT_NAME

Code: Select all

TR_DOWNLOADED_PATH="$TR_TORRENT_DIR/$TR_TORRENT_NAME"
or maybe things are different between linux and a mac?
That should always be the case now, but I'm thinking ahead to when https://trac.transmissionbt.com/ticket/1220 is added, and torrent's names won't necessarily match up with their directory names.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Call script when download complete environment variables

Post by Jordan »

LoveLoveMeDoYouKnow wrote:
isn't that in effect already included in the present env variables TR_TORRENT_DIR and TR_TORRENT_NAME
TR_TORRENT_NAME is the name of the torrent, not the name of the file(s) downloaded using the torrent.
In order to be able to copy the file(s) that were downloaded, I would need the path to the file(s).
I don't understand what you mean. Given the top level directory name, you sohuld be able to do a recursive copy, right?
LoveLoveMeDoYouKnow
Posts: 4
Joined: Tue Apr 21, 2009 8:44 pm

Re: Call script when download complete environment variables

Post by LoveLoveMeDoYouKnow »

[I don't understand what you mean. Given the top level directory name, you sohuld be able to do a recursive copy, right?
Two (or more) torrents might load to the same folder. Also the user might have choosen to download only some of the filen in the torrent. When a download completes I want to be able to identify the completed files and only the completed files from the specific torrent.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Call script when download complete environment variables

Post by Jordan »

I'm not so hot on this idea... this to me seems like a slippery slope. Someone else could request that we include the seed ratio in the environment variables so that they can move the files if its ratio is high enough... or the torrent's priority, to stop the torrent if its priority is low... and on and on.

I think you could use "transmission-remote --move" to do what you're suggesting. It already handles the case where two torrents are in the same folder.
LoveLoveMeDoYouKnow
Posts: 4
Joined: Tue Apr 21, 2009 8:44 pm

Re: Call script when download complete environment variables

Post by LoveLoveMeDoYouKnow »

I was waiting for the post download script feature for a long time, and once it is implemented I found that I could not write a script to copy the files, because I do not know (from within the script) what these files are.
Other users might ask for other information if it is useful to them, and each request should be judged by its usefulness. In my opinion the purpose of using Transmission is to download files and do something with those files. Handling those files should be the number one priority of the post download script. I have no use for the torrent hash or ID once the torrent has finished its download.
So to sum up: Knowing the paths to the downloaded files would make the post download script useful to me, and save me the trouble to constantly monitor Transmission and manually copy the files. In any case I appreciate the willingness to consider such features - thanks.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Call script when download complete environment variables

Post by Jordan »

I understand what you're saying. What I meant was I wonder how much of this is necessary to be in environment variables. For example there are already python, java, perl, ruby, and php modules that implement transmission's RPC protocol. (Links are at http://www.transmissionbt.com/resources.php.) Scripts in these languages can use RPC to learn all kinds of complicated information about the torrent.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Call script when download complete environment variables

Post by rb07 »

LoveLoveMeDoYouKnow wrote:So to sum up: Knowing the paths to the downloaded files would make the post download script useful to me, and save me the trouble to constantly monitor Transmission and manually copy the files.
Accessing torrent file list in the on-completion script
Post Reply