jbsoum wrote:Thanks for the reply! So if I understand correctly, hardlink does me no good at all. My best option is to use copy then delete after I hit a certain ratio. Is that correct?
So you use WebUI to automatically delete torrents once they hit a certain ratio? Do you do that with a script?
Hey, No problem and yes I use a script
First I changed my seeding ratio in
utorrent -> preferences - > Queueing: Seeding Goal, I set the Minimum ratio % to 200 so that each file that downloads has to double it's ratio before it stops seeding.. although you can choose a different percentage.
Secondly you need to setup WebUI, in utorrent's preferences go to
Advanced -> WebUI, enable it and set a username and password.. you can even set-up an alternative listening port.. but I just used the listening port found in
Connections.
Now I'm assuming you're a windows user, if not then you will have to modify the script for your operating system.. I'm nearly certain that all if not most programming languages have the ability to do this.. I know Java has this ability.. and it can be easily converted if you simply look via google.
As for the script itself, there are a few things you need to do (which should be done with any script, "including filebot CLI", when using it with a torrent client) and that's filter the torrents.. I use labels and the state of the torrent to choose whether or not a torrent will run through my script.
There are two reason for this, first part of the script will run when a torrent finishes.. so if it doesn't have a label called TV, MOVIES or MUSIC then the script exits instead of trying to run.
The other reason is because I also need a script to run when the torrent changes state, so if the label does not match or the state is not finished then it ignores it.
So instead of me giving you my entire script, as it's still a work in progress.. I'm going to simplify it by providing you with the webui part, I've also included the ability to filter using label which is optional as you can delete it from the script, but the state of the torrent is required.
Code: Select all
' If no arguments are made then the script wont run
If WScript.Arguments.Count = 0 Then 'If no Arguments >
msgbox "Missing Parameters"
Else
' Variables required for filebot and other stuff
Dim uState, uHash, WebUser, WebPass, WebHost, WebPort, WebAct 'Delete uLabel, if you don't want to filter by label
uState = WScript.Arguments(0) ' required to determine torrent state
uHash = WScript.Arguments(1) ' required to find torrent
WebUser = "user"
WebPass = "pass"
WebHost = "localhost" ' WebUI URL localhost|127.0.0.1, local connection is recommended
WebPort = "PORT" 'uTorrent listening port found in Preferences - > Connection
WebAct = "?action=removedata" 'Tells utorrent to deleted selected torrent
' Filtering using label OPTIONAL DELETE IF YOU DON'T WANT IT
Dim uLabel, WhiteList ' Delete This line if you don't want to filter label
uLabel = WScript.Arguments(2) ' Delete This line if you don't want to filter label
WhiteList = Array("TVSHOW","Music","Moves") ' Delete This line if you don't want to filter label
Automate
Sub Automate()
If Not IsInArray(uLabel, WhiteList) Then Exit Sub ' Delete This line if you don't want to filter label
If Not uState = 11 Then Exit Sub 'Exit if torrent not Finnished
uToken = Webui("token.html") 'Authentication
call Webui(WebAct &"&token="& uToken &"&hash="& uHash) ' Access WebUI, Action: Delete Torrent & Data
End Sub
' This will access the WebUI
' by first getting the token that is required
' and then taking the requested action.
Public Function Webui(WebRequest)
SET xmlhttp = createobject("msxml2.xmlhttp.3.0")
xmlhttp.open "get", "http://"& WebUser &":"& WebPass &"@"& WebHost &":"& WebPort &"/gui/"& WebRequest, False
xmlhttp.send
If WebRequest = "token.html" Then
Webui = Replace(Replace(xmlhttp.responseText, "<html><div id='token' style='display:none;'>", ""), "</div></html>", "")
End If
End Function
' YOU CAN DELETE THIS IF YOU'RE NOT FILTERING BY LABEL
Function IsInArray(strIn, arrCheck)
Dim bFlag : bFlag = False
If IsArray(arrCheck) AND Not IsNull(strIn) Then
Dim i
For i = 0 to UBound(arrCheck)
If LCase(arrcheck(i)) = LCase(strIn) Then
bFlag = True
Exit For
End If
Next
End If
IsInArray = bFlag
End Function
End If
Because I've stripped the code to give you the bare minimum, I'm not sure how well it will work, I have tested this out on one torrent, the script only runs when the torrent is in the finished state and has the required label.
In your utorrent, you will need to place some code into
"Run this program when a torrent changes state",
C:\Filename.vbs "%S" "%I" "%L"
You will also need to modify the labels you want to use and you need to include your webui username, password and port (the url for it should only be needed if localhost doesn't work)
Also note that if filebot fails to process your file, the script above won't know and it will delete the original regardless.. in mine at the moment I have my filebot setup to make a report once process has completed, I then have my script find the existing report before deleting the torrent, if the report doesn't exist then it pops up a message asking me if I still want to delete it.
If you want that function let me know and I'll throw that in as well.