Page 1 of 6

Need setup help to auto-extract torrent files

Posted: Sat Apr 09, 2016 7:31 pm
by Galana
Due to some nonsense from my torrent provider, I’m being forced to move away from Vuze, and need some help in establishing the same setup process.

Some quick baseline info.
R: is a RamDisk that I use to store the files as they are being downloaded, and the final destination for the extracted files.
V: is my NAS that stores completed files and the .torrent files.


What I am looking to do is:
1. Download the torrent into R: (Ramdrive), which is how my browser is set and works properly
2. The .torrent automatically starts running in QT
3. Have the files download in R:\TorrentTemp
4. Have the .torrent file move to V:\Completed\!Torrents
5. Upon completion, have the file auto-extract into R:\ using WinRAR at the file location in the run script*
6. Have the completed and extracted file move to V:\Completed

I know 4 & 5 could give a timing conflict, but since it’s a RamDisk, the extraction should be borderline instantaneous, at least before the files can move to a NAS.


What is happening with this setup is:
1. Torrent downloading to R:\  (as expected)
2. The .torrent automatically starts running in QT  (yup, happy here too)
3. Have the files download in R:\TorrentTemp  (so this is also working correctly)
4. The .torrent is moving as expected to V:\Completed\!Torrents  (4-for-4 so far!)
5. When completed, the extraction process fails.  I’m sure this is just a difference in the scripting setup between Vuze & QT, I’m just not sure what the conventions would be to make it work here.
6. The completed file is moving – but it’s moving to R:\ and not the correct V:\Completed

So nothing here should be particularly difficult, I’m just not sure what the script should be, and what the equivalent setting here is to Vuze’s “Completion Moving”.

Thanx!

Re: Need setup help to auto-extract torrent files

Posted: Sun Apr 10, 2016 5:54 pm
by ciaobaby

Re: Need setup help to auto-extract torrent files

Posted: Sun Apr 10, 2016 5:54 pm
by KitKat
You need to fully encapsulate the command with "s (start it with "H:\.. and end with R:")
qbittorent doesnt automagically do this as it was deemed "difficult/unneccessary/user should be intelligent enough to know when its needed" IIRC it supports multiple quotations so you should NOT have to change anything else in your command parameter.

Another thing to consider (likely un-needed, may break functionality) is changing %R to %F

Have a good day sir, apologies for the slow reply.

/e:
[quote="ciaobaby"]
index.php/topic,4140.msg21292.html#msg21292
[/quote]
I dont see how this helps him, unless you meant only the unhelpful"misunderstanding how it works" part ;/

/e2: I havent worked with winrar batching for a while but
[quote="Galana"]
What is happening with this setup is:
6. The completed file is moving – but it’s moving to R:\ and not the correct V:\Completed
[/quote]
You dont appear to specify you want to extract to V:\Completed as your commandline doesnt tell it to move stuff, it only tells it to extract the payload to R:\
You'd need to piggyback a MOVE command on afterwards or simply change R:\ to V:\Completed\%N
Assuming you want to subfolder it /w the torrents name.

Re: Need setup help to auto-extract torrent files

Posted: Mon Apr 11, 2016 5:31 pm
by Galana
Ok, so I have updated my script command to
"H:\Utilities\WinRAR\WinRAR.exe %R\*.r* R:\"

I knew about the " ", since Vuze required them as well, but only around the command, not the arguments.  When it didn't work in QT, I took them out thinking they might not be required.

As you stated, I don't want to extract to V:\Completed, I do want to extract to R:\.  The goal is once the extraction is completed, the files will then move to V:\Completed (my NAS) for long-term seeding. 
I assumed this is what would happen with the combination of "Save Files to Location" and "Keep Incomplete Torrents In", as seen by the screen-shot that I attached.  In Vuze, this is called "Completion Moving".  What is happening now is the following:
"H:\Utilities\WinRAR\WinRAR.exe %R\*.r* R:\"
The files do not extract, but the entire folder moves to R:\ (main folder), and the files do not move to V:\Completed (in spite of this clearly being defined in the "Save Files to Location")  But since the RAR extraction isn't working, I followed your suggestion to:

"H:\Utilities\WinRAR\WinRAR.exe %F\*.r* R:\"
This also does not extract, and now the entire folder moves to V:\ (main folder), which is really confusing since that drive isn't designated anywhere in the command.
*** I tried to replicate this error, and now it's copying the folder into R:\, which is still wrong since it's still not extracting, but at least it's the same net result as the %R designation.

I also tried going back to:
"H:\Utilities\WinRAR\WinRAR.exe" %R\*.r* R:\
which is the exact same script as was working on Vuze, and had the same result as the fully-encapsulated version (moves folder, no extraction, no copy to V:\Completed)


Any further ideas on getting the script to work right?  Or even better, build auto-extraction into the QT config options?

Re: Need setup help to auto-extract torrent files

Posted: Mon Apr 11, 2016 6:40 pm
by ciaobaby
but only around the command, not the arguments.
wrong way around,

If any of the arguments in the command line are likely to contain spaces they MUST be enclosed in quotes.

Re: Need setup help to auto-extract torrent files

Posted: Mon Apr 11, 2016 7:40 pm
by tekko

Re: Need setup help to auto-extract torrent files

Posted: Mon Apr 11, 2016 8:12 pm
by KitKat
Seems like an order of operations issue with qbittorent.
Could you uncheck the "Copy Completed Torrents to Location" part and see if the batch/extract/winrar command itself works as intended?
If it extracts properly could i suggest just slapping in the extra MOVE command via run external program aswell, and that would be a bug to bring up on github (qbittorents UI move on completed doesnt wait for move to finish/move acts incorrectly when external command is run)

I seem to recall sledgehammer saying qbittorent sends the "completed" message early so some delay may be needed in regards to the "run on completed" command.

A gem from the link tekko gave. try changing your extract script to this:
[quote="RavenousSix"]
"C:/Program Files/WinRAR/WinRAR.exe" x -ibck -inul "%F/*.r*" "%F/"
[/quote]
Modifying the location of winrar.exe as needed ofc and possibly reversing the /'s into \'s lol

(idk if on purpose or not but the quotes example exactly suits his purpose??)

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 3:29 am
by Galana
Victory!  On point 5 at least...  The extraction is now working.  I changed the last condition from "%F" to "R:/", and now it's doing what I want it to...  No clue that [ x -ibck -inul ] is supposed to do (and neither does Google), but it doesn't work with that removd - so I guess that's the secret.

Except

It's still moving the source files from R:\TorTemp to R:\ (main), which is the same folder as it's extracting to.  And this is even after I've changed the "Keep Incomplete Torrents in:" tag to R:\TorTemp - and left the "Save Files To" location blank (which then automatically populates with the Incomplete information - R:\TorTemp)...  Which does indeed force it to download in TorTemp - but nowhere in my configuration am I making any mention of R:\ (main) except - a) My WinRAR extraction location, and b) my Watch folder (which is functioning properly to auto-load the .torrents).

I really have no clue whatsoever why it could be possibly moving the files to that destination...  But at this stage it's largely irrelevant (although it is causing hell when Transmission picks up the .torrent file when THAT file moves successfully to my NAS upon completion, because it redownloads from scratch).  This is why I need to move the completed file to the NAS - so Transmission can pick it up and keep going with it with its internal system, and it's not taking any more resources on my system.  So how can I do the following:
COPY the completed files from R:\TorTemp to V:\Completed
then UnRAR from TorTemp (which is working, at least for now)
then DELETE from R:\ (main) where QBT seems determined to move the files to.

Alternately:
UnRar
then MOVE from R:\ (main) to V:\Completed
...  Assuming it can do this quickly enough that the NAS doesn't re-start the download from the .torrent file being moved first.  The first solution is likely the safer one, and more in line with the Move Completed function from Vuze that was working so well.


I've attached the screenshot again to consolidate updates.  NOTE that in an ideal scenario, the "Save Files To Location:" would be V:\Completed - but it seems that isn't in the cards at the moment, as regardless of that field, the files end up in R:\ (main)

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 4:02 am
by tekko
From winrar's help > command line mode > switches
  Switch -IBCK - run WinRAR in background
  Switch -INUL - disable error messages
Command X - extract files from an archive with full paths

If it's the same path, then you can uncheck "keep incomplete torrents in"
For what you want to do, I think the top path should be "V:\Completed"; though I am not 100% sure.

OR you can uncheck the box. execute a batch script to do xcopy, extract, delete, etc. (just an idea.)

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 5:43 am
by Galana
[quote="tekko"]
If it's the same path, then you can uncheck "keep incomplete torrents in"
For what you want to do, I think the top path should be "V:\Completed"; though I am not 100% sure.

OR you can uncheck the box. execute a batch script to do xcopy, extract, delete, etc. (just an idea.)
[/quote]

Thanks for the RAR info - makes a lot more sense now.

If I uncheck the Incomplete, then it initially downloads to my QBT install drive; which is my internet drive, which I have all my email and settings on - so I don't want to increase the load on that drive.  Plus it's small - I have 48Gb of RAM for my RamDisk, while my Internet drive is only 8Gb - so it can't even hold a lot of the larger torrents out there.  I have done exactly as you suggested, and the final result is that it downloads on my I: drive (Internet, duh), and still copies when complete onto R:\ (main).  It has NEVER copied to the V:\ drive...  Yet the completed .torrent file moves there just fine.  Like, it really doesn't make any sense.  I quite like the look and layout of QBT, but what I'm looking to do really isn't difficult, and that's very frustrating when it fails with an inexplicable result.

I have no idea how to write a functional script to do these things.  Like, I know how a .bat file works, and all that jazz...  I just don't know what commands / conditions will be effective.  I tried building one for Vuze, and it was an absolute failure.

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 5:58 am
by tekko
click on the torrent and click on the general tab. What's the "save path" ?

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 6:19 am
by Galana
[quote="tekko"]
click on the torrent and click on the general tab. What's the "save path" ?
[/quote]

With Save Files to V:\Completed and Incomplete to R:\TorTemp:
"Open Destination Folder" goes to R:\TorTemp
"Set Location" goes to R:\ (main)

I manually changed the "Set Location" to V:\Completed, and that did work - when completed, it went where it was supposed to, after extracting like it was supposed to, and Transmission (the NAS) picked it up like it was supposed to.
However
On the next download, the "Set Location" defaulted back to R:\ (main)...  And I've triple checked the Options->Downloads->Save Files To...  It says V:\Completed.

HOWEVER

Looking at how it's generating R:\ as my default when I only have it as a Watch Folder (as well as V:\, but R:\ is first), maybe that is causing some confusion.  It only says "Watch", so really, what can be going wrong...  But what happens if I put V:\Completed in the #1 slot on the Folder Watch list...  Ohhh, and there's a drop-down arrow beside Watch; and another option Default...  So what if I make my Default drive V:\Completed, and have two Watch locations - R:\ and V:\Torrents...

And we have a winner.  So the moral of the story, it looks like if you have something in your "Watch" folder, that will override the "Save To Location" setting - even if it is only set as Watch, and not Default.  That seems like a fairly significant oversight - but hopefully it's found, will be confirmed, and eventually squashed like a bug!

I'll play with it the next few days, but no news will be good news!!!

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 6:34 am
by tekko
The "save files to location" only affects newly added torrent, not existing.
And I missed the watch folder part since I don't use it...

The watched folder is like... if you drag a .torrent file in that folder, it will be added to qbt for download/seed and the contents will be saved to the "save files to" location.

Dunno if u misunderstood the watched folder part.

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 7:13 am
by Galana
[quote="tekko"]
The "save files to location" only affects newly added torrent, not existing.
And I missed the watch folder part since I don't use it...

The watched folder is like... if you drag a .torrent file in that folder, it will be added to qbt for download/seed and the contents will be saved to the "save files to" location.

Dunno if u misunderstood the watched folder part.
[/quote]

Oh, I definitely know what the Watched Folder is intended for - it worked perfectly in its intended function.  But it's also pretty clear if you review the posts and the screenshots, that was the only place I had R:\ (main) listed, and it was where the finished file was defaulting to.  As soon as I changed that table, then things started working like they were supposed to.  It was too instant a fix to be just a coincidence.

Re: Need setup help to auto-extract torrent files

Posted: Tue Apr 12, 2016 7:32 am
by tekko
I haven't used the watched folder much. If you think something isn't working as it should, be sure to write down the steps to reproduce and report it as a bug.  ;)