Page 1 of 1

How to track a new added torrent by its ID?

Posted: Wed Jan 24, 2018 1:43 pm
by BlurryScript
for example i've added a torrent file to watch-dir with an id in his name like

Code: Select all

`mytorrent_123.torrent`
for example the 123 is the id i want to get after the download completes:

Code: Select all

    "script-torrent-done-enabled": true,
    "script-torrent-done-filename": "/opt/torrent_complete.sh",
so this is the script that will be executed, is there a way I can get the ID of that torrent or something to make a track of it?
after the download is done I want to be sure that the completed download was from this torrent, is there a way to get an id or something to trace it somehow?

Re: How to track a new added torrent by its ID?

Posted: Wed Jan 24, 2018 2:09 pm
by mike.dld
Information about original torrent file name is lost after you add it. If you want to track the torrent completion, you'll need to either use infohashes or map those to your IDs. E.g. you could get an infohash by executing

Code: Select all

transmission-show mytorrent_123.torrent | awk '/Hash:/{print $2}'
. Then when your completion script is called, Transmission passes infohash value in TR_TORRENT_HASH environment variable. Note that you also get TR_TORRENT_ID environment variable but it contains internal torrent ID (as could be seen via transmission-remote) that is not persistent across session restarts and has nothing to do with what you put in torrent file name.