AMC and Utorrent: Continue Seeding

Any questions? Need some help?
Post Reply
jbsoum
Posts: 21
Joined: 01 Feb 2015, 16:27

AMC and Utorrent: Continue Seeding

Post by jbsoum »

Hey, I'm pretty new to Filebot, but I've been using it to clean up my anime collection for XBMC/Kodi with positive results. I noticed the AMC script and it seems to do some pretty impressive stuff. My understanding is that it tries to tell the difference between anime, TV, and movies, then puts them in separate locations depending on what the file is; this is exactly what I'm looking for.

I couldn't tell from reading the documentation, but does the script update the torrents to the new locations? If not, I was wondering if anyone has had any success with this?

Thanks!
User avatar
rednoah
The Source
Posts: 23934
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC and Utorrent: Continue Seeding

Post by rednoah »

The script is supposed to copy or hardlink files into a new structure. Hence nothing needs to be updated. Moving files is not supported.
:idea: Please read the FAQ and How to Request Help.
jbsoum
Posts: 21
Joined: 01 Feb 2015, 16:27

Re: AMC and Utorrent: Continue Seeding

Post by jbsoum »

Thanks for the fast reply! So hardlinking sounds like what I'm looking for, right? If the files are copied, that means that the version of the file being seeded is the original in the unprocessed download location, but I would like the renamed version of the file to be seeded while only maintaining one version of the file.

Do I set this with --action hardlink? I'm sorry if I sound confused.
skullzy
Power User
Posts: 50
Joined: 07 Jan 2015, 22:19

Re: AMC and Utorrent: Continue Seeding

Post by skullzy »

What your looking for jbsoum isn't supported, filebot is used to organise your media, in order to do what you want to do, it would have to be done manually, this requires you to change the completed download path of the file within utorrent itself.

If I understand you correctly, you want to rename the original file while seeding it using utorrent, which isn't possible with filebot as I've stated above.

Hardlink however, would allow you to create like a reference to the original file, you could rename the other file but not the original as this would break the link, same goes for deleting the original, (example would be deleting torrent + data) in utorrent.

If you only plan to seed until you reach a specific ratio, then doing all this would be pointless as it would still require you to move the original file to the new location and then rename it.

You could use WebUI as a means to send a delete request once seeding has completed.. this is something I do as my system is on 24/7 so once my RSS downloads a series it will then delete the torrent + data once seeding has reached 300% ratio.
jbsoum
Posts: 21
Joined: 01 Feb 2015, 16:27

Re: AMC and Utorrent: Continue Seeding

Post by jbsoum »

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?
skullzy
Power User
Posts: 50
Joined: 07 Jan 2015, 22:19

Re: AMC and Utorrent: Continue Seeding

Post by skullzy »

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.
Post Reply