[Windows] uTorrent - Sharing my automated Vbscript
Posted: 07 Jun 2015, 03:40
[17/10/2015]
I've been trying to figure out how to convert my vbscript to groovy, this got me thinking about cleaning up the script even more as my previous vbscript was more of a rush job than anything else, so while I work on making a groovy version this is a new improved and overall better version.
This script has the following features.
The Filter -
Episode Age!
The filter has been improved a lot thanks to Rednoah for suggesting to use the age feature instead of airdate.timestamp, which means it will now only look into the past, i've even added the ability for those using this script to easily change how far back, "in days", to check for that episode. Min 1 day Max 6 days default is 4, if you attempt to set a day less than 1 or greater than 6 then the default value of 4 will be set in it's place.
Labels
The filter it'self is a hell of a lot faster now that I've switched from using arrays to using vbs's dictionairy object (known as map in groovy), in my old script I would use a list of labels and loop through them looking for the label set by utorrent, now it simply checks to see if it exists, this also reduces filesize.
Manual series search
I've added the ability to set up custom labeling that will be used to manually search for a series, this will eradicate an issue I had with naming some shows. This works thanks to the --q feature in filebot.
The Log -
I've changed the function of how my script verifies the filebot log, I have created a function that will check the logs last line and verify it has completed successfuly, if for some reason filebot failed it will now pause the torrent instead of popping up with an error message. This allows me to check the log when I get home to find out what caused the problem.
The Clean Up -
Once the torrent completed successfully and reaches the finnished state, this script will delete the filebot log + Torrent & Data.
The following arguments remain the same in utorrent.
When torrent finishes
When torrent changes state
It is also important that you go to Queueing in uTorrent preferences and set a seeding goal, I use Minimum ratio % 200. Also go to Advanced -> UI Extras and add the default label tvnew|tvold|movies so that you have the ability to simply right click and select the label, which will prevent typos, then go to WebUI, enable and set a username and password.
Download Automate.vbs via dropbox.
Here is a breakdown of the script settings.
Essentially these are the default labels set-up for filebot to determine whether or not to use the age filter or whether not to process the torrent, example: if the torrent that downloaded doesn't contain a primary label of tvnew, tvold or movies (or the custom labels I'll show you in a second), then the script will not run. In utorrent the label isn't case sensitive, so you can set a label like so tvnew, TvNew, TVNEW.. as long as it's spelt corectly it will work
For obvious reasons don't edit were it says not to edit, the following code is your filebot settings, now the important settings for this script to work have been added later, these are the settings you have control over, by default I have action as test, as I assume you'll want to try it out before you actually use it, I would recommend using copy for the action setting as the script will auto-delete the torrent and data once the seeding goal has been reached, essentially you already know what seriesFormat and movieFormat is, I never added anime because I don't download it, however it would be a simple case of adding that option in then including it in the main part of the script.
Okay so this is the custome label you can set to manually search for a series in filebot, to use this is fairly simple, you have a Key and a Value, the Key is what the label in utorrent has to be and the value is what you want to input for the search. Special.Add "label_here", "Series Name"
So let's say in my RSS feed I had American Dad, I would set it up with a label like American_Dad or whatever I want it to be, so when my RSS auto-downlaods the show it will have that label, in my special label setup I then add this like so --> Special.Add "american_dad", "American Dad!", I would do this between the "> Add/Remove series here >" comments.
The special labels are just like the tvnew label except it adds the manual search. So instead of filebot auto-detecting the series name, it will look for American Dad! and try to find the last episode aired in the past 4 days.
The comments for this are self explanatory, but remember that if you set a value that is outside of the min/max days allowed, it will use the default in order to prevent issues.
This allows my script to pause and or remove torrent+data within utorrent.
I should also note that the function for verifying logs will use the default location, which is %appdata%\filebot\logs
If you notice any bugs let me know, although this has been up and running on two seperate machines and both appear to be running smoothly, in fact this script is faster than it's predecessor. Enjoy
I've been trying to figure out how to convert my vbscript to groovy, this got me thinking about cleaning up the script even more as my previous vbscript was more of a rush job than anything else, so while I work on making a groovy version this is a new improved and overall better version.
This script has the following features.
The Filter -
Episode Age!
The filter has been improved a lot thanks to Rednoah for suggesting to use the age feature instead of airdate.timestamp, which means it will now only look into the past, i've even added the ability for those using this script to easily change how far back, "in days", to check for that episode. Min 1 day Max 6 days default is 4, if you attempt to set a day less than 1 or greater than 6 then the default value of 4 will be set in it's place.
Labels
The filter it'self is a hell of a lot faster now that I've switched from using arrays to using vbs's dictionairy object (known as map in groovy), in my old script I would use a list of labels and loop through them looking for the label set by utorrent, now it simply checks to see if it exists, this also reduces filesize.
Manual series search
I've added the ability to set up custom labeling that will be used to manually search for a series, this will eradicate an issue I had with naming some shows. This works thanks to the --q feature in filebot.
The Log -
I've changed the function of how my script verifies the filebot log, I have created a function that will check the logs last line and verify it has completed successfuly, if for some reason filebot failed it will now pause the torrent instead of popping up with an error message. This allows me to check the log when I get home to find out what caused the problem.
The Clean Up -
Once the torrent completed successfully and reaches the finnished state, this script will delete the filebot log + Torrent & Data.
The following arguments remain the same in utorrent.
When torrent finishes
Code: Select all
C:\AutoMate.vbs "Fb" "%L" "%S" "%N" "%K" "%F" "%D" "%I"
Code: Select all
C:\AutoMate.vbs "Wb" "%L" "%S" "%N" "%K" "%F" "%D" "%I"
Download Automate.vbs via dropbox.
Here is a breakdown of the script settings.
Essentially these are the default labels set-up for filebot to determine whether or not to use the age filter or whether not to process the torrent, example: if the torrent that downloaded doesn't contain a primary label of tvnew, tvold or movies (or the custom labels I'll show you in a second), then the script will not run. In utorrent the label isn't case sensitive, so you can set a label like so tvnew, TvNew, TVNEW.. as long as it's spelt corectly it will work

Code: Select all
Option Explicit
' Default Label Setup - DON'T EDIT; unless you know what you're doing.
Dim Label, ObjShell, UsrDir, Filebot, Special, Ep_Age, WebUI
' Dictionary Object
Set Label = CreateObject("Scripting.Dictionary")
Label.Add "tvnew","tvnew" ' Recently Aired episodes within Age range.
Label.Add "tvold","tvold" ' Old Episodes outisde of Age range.
Label.Add "movies","movies" ' Movies :)
For obvious reasons don't edit were it says not to edit, the following code is your filebot settings, now the important settings for this script to work have been added later, these are the settings you have control over, by default I have action as test, as I assume you'll want to try it out before you actually use it, I would recommend using copy for the action setting as the script will auto-delete the torrent and data once the seeding goal has been reached, essentially you already know what seriesFormat and movieFormat is, I never added anime because I don't download it, however it would be a simple case of adding that option in then including it in the main part of the script.
Code: Select all
' FileBot Setup
' DON't Edit THIS >
Set ObjShell = WScript.CreateObject("WScript.Shell")
' UserDir = C:/Users/Bob
UsrDir = replace(ObjShell.expandEnvironmentStrings("%userprofile%"), "\", "/")
' Dictionary Object
Set Filebot = CreateObject("Scripting.Dictionary")
' < DON't Edit THIS
' Settings
' --action test | copy
Filebot.Add "action", "test"
' --output C:/Users/Bob/Documents
Filebot.Add "output",UsrDir & "/Documents"
' seriesFormat=C:/Users/Bob/Documents/Tv/Dexter/Season 1/Dexter - s01e01 - Dexter.mp4
Filebot.Add "seriesformat","/Tv/{n}/Season {s}/{n} - {s00e00} - {t}"
' movieFormat=C:/Users/Bob/Documents/Movies/Jurassic World (2015).mp4
Filebot.Add "movieformat","/Movies/{n} ({y})"
' uTorrent and script settings are preset in the main script
So let's say in my RSS feed I had American Dad, I would set it up with a label like American_Dad or whatever I want it to be, so when my RSS auto-downlaods the show it will have that label, in my special label setup I then add this like so --> Special.Add "american_dad", "American Dad!", I would do this between the "> Add/Remove series here >" comments.
The special labels are just like the tvnew label except it adds the manual search. So instead of filebot auto-detecting the series name, it will look for American Dad! and try to find the last episode aired in the past 4 days.
Code: Select all
' Special Label Setup
' Dictionary Object
Set Special = CreateObject("Scripting.Dictionary")
' Change the following value to 0 if you wish to disable this feature
Special.Add "enable","1" ' Value: 1 = true, Value: 0 = false
' > Add/Remove here >
Special.Add "forever_us","Forever 2014"
Special.Add "american_dad","American Dad!"
' < Add/Remove here <
Code: Select all
' Series Episode Age
' Change this in order to decrease or increase how far back to look for the episode.
' Minimum 1 : Maximum 6 : Default 4
Ep_Age = 4 ' Days
Code: Select all
' Controlling uTorrent via WebUI
' Dictionary Object
Set WebUI = CreateObject("Scripting.Dictionary")
WebUI.Add "user","user" ' WebUI username
WebUI.Add "pass","webui" ' WebUI password
WebUI.Add "host","localhost" ' WebUI URL localhost|127.0.0.1, local connection is recommended
WebUI.Add "port","12345" ' WebUI uTorrent listening Port
If you notice any bugs let me know, although this has been up and running on two seperate machines and both appear to be running smoothly, in fact this script is faster than it's predecessor. Enjoy
