Hey Folks,
So before I begin, this script was designed originally for my Torrent client as I don’t use USENET, however I believe I may be able to include USENET in a future version, at the moment I only use Torrents, but after some research I believe it might be possible to include USENET, I would need to download and look through SabNZB in order to figure that out.
Now, for this to work on a torrent client it needs to run the script with the required parameters once a download has completed, so after a download has reached 100% it will send the following arguments to the script.
-
Label
The default is Sonarr|Radarr but these can be customised within the script. -
Path
This is the completed download path/ final directory. -
Name: Torrent Title (Usenet Original NZB filename)
This will be used to create the folder we will extract to. -
downloadClientID: Torrent Info Hash, (nzoid for SabNZB)
“so Sonarr knows that a particular download has already been imported.”
Download
You can get the script from Pastebin
Give it any name you want but save it as a .vbs, for example, I named mine AutoScript.vbs
In your Torrent client you would have something like this
C:\AutoScript.vbs “Label” “Directory” “Name” “InfoHash”
REQUIREMENTS
-
Windows Operating System
To my knowledge all windows systems created after 1996 can run visual basic scripts. -
A Torrent client
As long as the client can run a script once a download has reached 100% and call the arguments mentioned above, then you shouldn’t have any issues, my server runs torrent, I have plans to replace this with deluge or qBittorent in the future but at the moment it would be too much hassle. -
Winrar
I stuck with this out of laziness, it was already on my server and I used it with my old script for drone factory, but I might change to 7zip. On a side note, if you know the command line to extract in 7zip you could easily change this yourself.
CONFIGURATION
Configuring the script is pretty straight forward, for those who don’t code or know anything about VBScript, please don’t get intimidated, I’ve made it pretty easy to use.
Note: All labels in the script are case-insensitive.
Sonarr/Radarr
In my script, about 18 lines down, you want to look for the following snippet of code.
'allowedLabels.Add “sonarr”,“localhost:port^^APIKEYHERE^^DownloadedEpisodesScan”
'allowedLabels.Add “radarr”,“localhost:port^^APIKEYHERE^^DownloadedMoviesScan”
Let’s break this down.
The single quote at the beginning of each line tells the script to ignore that line, so you will want to remove the single quote (’) at the beginning of sonarr, radarr, or both, depending on what you use.
If you are using a different label for Sonarr or Radarr, then you simply replace the word sonarr or radarr with your custom label.
You then replace localhost:port with the address that links to your sonarr or radarr site, if your address uses https:// then make sure to include this, and don’t add a forward slash (/) at the end of the address.
Lastly, APIKEYHERE, is where you put your API key, which you can get in Sonarr and Radarr by going to Settings > General > Security > API Key.
You DO NOT want to edit DownloadedEpisodesScan or DownloadedMoviesScan, as these are required by Sonarr and Radarr
So, once you’re done, you should have something that looks like this.
allowedLabels.Add “series”,"127.0.0.1:9899^^13281w1w85w8d1w1w858dqdw^^DownloadedEpisodesScan"
allowedLabels.Add “movies”,“127.0.0.1:9891^^132ab8wc18qc918et81wf1w85w^^DownloadedMoviesScan”
If you have winrar installed in a different directory, you will need to change the code on line 53 so that it points to that directory.
And speaking of winrar, for those who want to replace winrar with 7zip, you would also need to edit the code on line 67 & WinZip & “Unrar.exe”" e –y
WinZip is the variable that points to the Winrar directory.
OTHER NOTES
I have not thoroughly tested this yet as I only made my first script three days ago and have been slowly improving it, this pretty much means I don’t know it’s limits, but so far it is extracting my shows and movies once completed and then notifying Sonarr and Radarr to scan the location the files where extracted to. Once a torrent has finished, Sonarr and Radarr will remove the torrent if you have that option enabled.
Now this script is 100% dependant on the torrent client notifying it once a download has completed, it also relies on having an active authorised connection to sonarr/radarr, it won’t continuously monitor folders and it will only make one attempt to extract the file and call sonarr/radarr, so if sonarr/radarr goes down or if the extraction fails it won’t make another attempt.
Currently, this script doesn’t scan subfolders and it doesn’t queue each extraction, it’s pretty much in its Alpha stage, my reason for sharing this is to try and inspire other users to either improve upon my script or to build their own.
WHY I’M HERE/HOW I GOT HERE
Now this is my first time in the forums and thought I would share my script with those who may need it or who may be inspired to create something better, I rarely need to jump on Sonnar but I went on three nights ago and discovered the dreaded notification telling me that drone factory was pretty much being removed/replaced, like many other users this felt like a slap to the face as I relied on drone factory for my extracted files, but I understood why it has to go.
So I searched the web looking for a solution, something that didn’t require me to install and configure more software, I wanted something light that could just run on windows, instead I was faced with threads of users complaining about this decision instead of working together for a solution, so with little to no option I was forced to build this script, it only took me about an hour to figure out the API and to get a working script, but for the past two-three days, in my spare time, I’ve been slowly improving my original script and I plan do more improvements and possibly add other features as I go.
Anyway, enjoy.