So whenever I download a torrent file I put it in a different folder in my hard drive, and from time to time I have to format my main hard drive. I still have the old things I downloaded, but I was thinking of writing a script which will go through a folder full of .torrent files, check to see if the file/folder exists in a folder and then adds the corresponding .torrent file to transmission if it does as to not download the files again, but to let me seed what I have.
So first is there already something like this I am just missing, and where would I start here? How does transmission check to see if the information is in the folder? How would I go about adding mass files to transmission(in linux)? I am assuming there is a log file somewhere it stores everything it's seeding.
a script to add torrent files if they are in directory
Re: a script to add torrent files if they are in directory
It should be possible to do this now, though the script may get a little involved. You can extract the relative path information from a torrent file using either transmission-show or (perhaps less awkwardly) by parsing the file yourself, e.g. with the Bencode perl module. If the files from the torrent exist at the path where you expect, add the torrent witha script which will go through a folder full of .torrent files, check to see if the file/folder exists in a folder and then adds the corresponding .torrent file to transmission if it does
Code: Select all
transmission-remote -a <the torrent file> --download-dir <that path>
Last edited by ijuxda on Mon Feb 14, 2011 4:00 am, edited 1 time in total.
Re: a script to add torrent files if they are in directory
ijuxda wrote:It should be possible to do this now, though the script may get a little involved. You can extract the relative path information from a torrent file using either transmission-show or (perhaps less awkwardly) by parsing the file yourself, e.g. with the Bencode perl module. If the files from the torrent exist at the path where you expect, add the torrent witha script which will go through a folder full of .torrent files, check to see if the file/folder exists in a folder and then adds the corresponding .torrent file to transmission if it doesCode: Select all
transmission-remote -a <the torrent file> --download-dir <that path>
Okay cool, but how can I check to see if the torrent's data is already in the folder?
Re: a script to add torrent files if they are in directory
In bash and perl there is the expression -f <file> that evaluates to true if the file exists.how can I check to see if the torrent's data is already in the folder?
I'm not sure if you're asking for help with transmission, or help with scripting in general. There are lots of resources available to help with the latter that are much better than this forum.
Last edited by ijuxda on Mon Feb 14, 2011 4:00 am, edited 1 time in total.
Re: a script to add torrent files if they are in directory
That transmission-remote thing was pretty much all I needed from transmission I guess.ijuxda wrote:In bash and perl there is the expression -f <file> that evaluates to true if the file exists.how can I check to see if the torrent's data is already in the folder?
I'm not sure if you're asking for help with transmission, or help with scripting in general. There are lots of resources available to help with the latter that are much better than this forum.
I know how to check if a file is there, I don't know how to check a .torrent file to see if it's target is already in the directory. A finger in the right direction is all I need.
Re: a script to add torrent files if they are in directory
If you run transmission-show on a torrent file, you get output along the lines ofI know how to check if a file is there, I don't know how to check a .torrent file to see if it's target is already in the directory. A finger in the right direction is all I need.
Code: Select all
<stuff you do not need>
FILES
path/to/file1 (<size>)
path/to/file2 (<size>)
another/path/to/file3 (<size>)
<and so on>
I'm sorry if I did not immediately give you the answer and as such seemed less than willing to help, but I believe it does a better service to you in the long run to have you teach yourself the needed skills rather than if I were to write the script for you.