Powershell automation script for downloading anime from Nyaa
The script operates via folder name conventions.
There is a general folder that contains all of the shows folders.
Each show folder has the name of the show that the uploader wrote as the file name and the episode number to be watched.
Meaning for example that if I'm watching 2.43 Seiin Koukou Danshi Volley Bu
and the uploader names his episodes:
Than the folder name will be as it is in the file name:
For episodes to be downloaded, the folder names should be in the convetion of <show name> - <episode number that you didn't watch yet>
Lets look at the former example, if I would like to download every episode of 2.43 Seiin Koukou Danshi Volley Bu
from episode 1
onward until the latest one
, I would name the folder as follows:
For reference, your folders should look a little something like this:
The script will search for each show episode multiplied by the number of uploaders you have,
meaning for example that if I didn't find an episode with 'Erai-raws' as the uploader it will try searching the same episode with 'SSA' as the uplodaer and etc...
For the script to work BitTorrent/UTorrent
should be used and configured as such:
-
New downloads should be put in a static place:
-
Maximum number of active torrents and downloads should be equal and seeding should be disabled:
The reason seeding is disabled is because seeding a torrent keeps open handles to it meaning the file is used and cannot be moved automatically.
-
Powershell v5.1+
If you're not updated (check by running
powershell $host
in your cmd window)You can install the latest version: .NET Framework
-
Microsoft Office / Office 365
This requirement was a doozy for me as well, there are some Powershell functions that will not work unless Microsoft Office / Office 365 are installed
The script contains some variables for you to configure:
-
$series_path
:# Anime series folder path [Parameter(Mandatory=$false, Position=0)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] [string] $series_path = "E:\Series",
The path of the general folder that contains all of the shows folders
Change
E:\Series
to your desired location
-
$torrent_default_download_path
:# Torrent defalt download path [Parameter(Mandatory=$false, Position=1)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] [string] $torrent_default_download_path = "E:\",
The path of the folder where torrents are placed after downloading
Change
E:\
to match the path you assigned in your torrent client
-
$pause_script_at_end
:# Flag to pause script at the end (debug etc...) [Parameter(Mandatory=$false, Position=1)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] [boolean] $pause_script_at_end = $false,
As the name suggests, it's for debug purposes
If you wish to change it so you could stop the script window after it ends change from
$pause_script_at_end = $false,
to$pause_script_at_end = $true,
-
$filter_type
:# Filter Type [Parameter(Mandatory=$false, Position=3)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] [ValidateSet("No filter", "No remakes", "Trusted only")] [string] $filter_type = "Trusted only",
The filter in the Nyaa site:
Types of filters to change to:
"No filter"
"No remakes"
"Trusted only"
-
$episode_quality
:# Episode quality [Parameter(Mandatory=$false, Position=3)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] [ValidateSet("1080p", "720p", "480p")] [string] $episode_quality = "1080p",
Quality of the episodes downloaded, possible values:
"1080p"
"720p"
"480p"
-
$uploaders
:# Uploaders [Parameter(Mandatory=$false, Position=4)] [ValidateNotNull()] [ValidateNotNullOrEmpty()] [string[]] $uploaders = @("Erai-raws","SSA","SmallSizedAnimations")
The uploaders that will be taken into account when searching for episodes
You can add or remove them by changing the values in the
@( ... )
area, values in quotations and seperated by comma
Running the script is as easy as right click and clicking the Run with Powershell
button: