All you can eat: Anime

Let me get started with this: If this is illegal where you live, I do not recommend you to follow the steps described below. I will not be the one to judge others.

Why would you do this? Simple – Not every distinctive Anime shown in Japan makes it out of Japan. At least not without the wait or the time it takes to license and dub a show. Reminder: Support the studios that bring you Anime!


With that out-of-the-way, let me give you a quick summary of what this will do once you are done:

You sit on your lazy bum (or go to work) and before you know it (once you come home) you will find your Anime downloaded (as it releases) and sorted (onto their respective folders) ready for your consumption.

Here are a few assumptions:

  • You have a shared folder named “Anime”
  • You can defend yourself in a terminal shell
  • You can upload files to your DiskStation, Server, etc.

Do not worry, if the second line bothered you.

For this guide, I use my Synology DS1513+ and a MacBook Pro to manage it. A Windows or *nix system will have no issue doing the same if you already know how to manage from your respective OS.

Let’s cover those bullet points one by one.

This tutorial, covered by Synology itself, will get you going with shared folders. Just name the folder “anime” (or anything else if you prefer, but for this guide, that is what I will refer to it by). Make sure you give that folder the right permissions and that you can access it from the network once it is set up.

I like to save my automation scripts to a share named auto and my downloads to a share named, wait for it, downloads…

For this guide, create a share named “auto” and grant yourself permissions and network access (we will be removing network access to this folder later) as well as a “downloads” share (unless you already have one). Once you create this folder, browse to it via your computer or the WebUI (DSM) for the DiskStation and create a folder named “completed“. Inside this folder, create an “anime” folder. This is where our completed Anime downloads are saved before renaming and then moved to the anime shared folder.

DSM Folder Structure
DSM Folder Structure

Those two images should give you an idea of what I am looking for. Click on them for a closer look.

Let’s move on. Time to introduce you to the star of the show: shanaproject.com.

Best way to describe them is already done, so I’ll use that:

Shana Project provides a few features to help you automate your anime downloads. Using these features you can follow your favourite shows, you can then use your private RSS feed to setup your bittorrent client to automatically download your anime.

Nifty right, it is. If you already use them, you just saved yourself the initial setup, skip further below.

If you just discovered them, sign up right now! They also provide a very good help guide for their system (they call it follows), so read that as well. After that, we need your private RSS feed to set up the rest, so read this as well.

DSM Package Manager
DSM Package Manager

Time to set up our download manager, Download Station. Go to DSM and if you haven’t already, install Download Station.

Open it and look for the Settings icon on the lower left of your screen.

From there, lets set the default directory for all downloads. Look for the “Location” tab and where it says “Default Destination Folder” click on Select. Browse to > downloads > completed (folder we created earlier) and click on Select.

Download Station - Location Settings
Download Station – Location Settings

Next, click on the “BT” tab, and set this however you prefer. Share (seed) back if you can.

Download Station - BT Settings
Download Station – BT Settings

Finally, click on the “RSS” tab and set the Update Interval to 30 minutes (you do not want a value lower than this). Click on “OK” once you are done.

Download Station - RSS Settings
Download Station – RSS Settings

You should be back on the main screen. See where it says “RSS Feeds“? Click on that tab and copy your private RSS Feed URL from your settings page on shanaproject.com.

Download Station - RSS Feeds
Download Station – RSS Feeds

Click on the plus icon (on Download Station) and paste your private RSS Feed URL on the field labeled “Enter RSS URL:”. Select “Automatically download all items“, set the Destination to > downloads > completed > anime and click Add.

Download Station - Add RSS Feed
Download Station – Add RSS Feed

You can rename the feed if you wish. Select it from the list (if you have more than one) and click on the pencil (Edit) icon. I used “Shana Project RSS“. You can also edit the URL here if you messed it up.

This will be all for now until the next part. Any Anime that matches your follows will be grabbed by Download Station with no intervention on your part.

Looking forward to the next post, this is where some nifty scripting can take care of your collection for you (except for watching it, that is).

Time to set up our scripts! Hang in there, this will become second nature once you see how easy it is to do this.

Remember that auto-share we created? Time to make use of it. Go ahead and open File Station and browse to that folder.

A good programming practice is to not reinvent the wheel (improve upon, fix issues, but don’t re-write if someone has already done it). We will be making use of an awesome script for Sabnzbd+ that happens to be flexible enough for our needs. Say hi to Benni-chan for me if you ever get the chance.

We also need to keep our script updated, but in the greatness of the internet, there is already a way to do this easily with some shell scripting. A big thanks goes to Chris Simpkins for his awesome work,

Go ahead and right-click, save as on this link: gitupdate.sh

Just make sure your OS does not rename it to anything else. Save this in the auto folder on the DiskStation. Switch over to DSM and Refresh the current folder, you should be able to see the script in there now. Right-click on the script and select Properties. If you haven’t modified your DiskStation much, you will see admin as the owner. Click on the Permissions tab to confirm admin had Read & Write permissions.

Now we need to grab our script from Benni-chan’s GitHub repo: nzbToAniDB. This script runs on Python so we need that, but we want to be able to update it as well, so time to set up SSH and Git first.

Enabling SSH is easy enough: Open Control Panel (on the DiskStation), click on Terminal & SNMP. On the Terminal tab, click on “Enable SSH Service” and click on Apply. We will be disabling this later (you want to secure your DiskStation really well if you want to leave this on).

DSM Control Panel - Terminal & SNMP
DSM Control Panel – Terminal & SNMP

If you get any firewall notifications, make sure to accept the changes and add the rules to your firewall.

Time for Git! Simply, open Package Center > Utilities > Git Server. Install if you don’t already have it.

If you already have tools like Sabnzbd+, Couchpotato or SickRage (SickBeard), then you already have a version of Python installed. If not, be sure to grab it from the Package Center as well.

Let’s keep at it, depending on your OS, you may need a Terminal application. For OS X, it is located in Applications > Utilities > Terminal. On Windows, you can use PuTTY to connect to an SSH server. I’m on a MacBook so my screenshots will reflect that. Anyway, fire up your Terminal and send the command:

ssh root@[ip of your diskstation]

Replace [ip of your diskstation] with the actual IP address. To send a command, you simply hit your Return (Enter) key. You should be seeing something as boring as this:

OS X - Terminal
OS X – Terminal

Now we do something interesting (Nah, still boring!). Send the following commands:

cd /volume1/auto/ && ls -la

This changes our working directory to the auto-share we created earlier and lists all the files in that folder along with permissions assigned to those files. All we are looking for here is that the file gitupdate.sh has the proper execute permissions.

OS X - Terminal
OS X – Terminal

Go ahead and run the following commands to set the right permissions on that file:

chmod 755 gitupdate.sh && chown admin:users gitupdate.sh

Still with me? Time to download nzbToAniDB. Run the following command:

git clone https://github.com/Benni-chan/nzbToAniDB.git

This will create a directory named nzbToAniDB in the auto folder and pull the respective files from the nzbToAniDB repo into that folder. Before we set it up, let’s assign the proper permissions here as well. Run the following commands:

cd nzbToAniDB/ && chmod 755 nzbToAniDB.py

Continuing on (next part coming soon)…

Minimize your terminal application for now. Open the Task Scheduler on DSM (Control Panel) and create a new User-defined script. On the Create task window that appears, name the task “Update nzbToAniDB” and leave the user as root. Below, on the Run command section, in the User-defined script box, type:

sh gitupdate.sh /volume1/auto/nzbToAniDB/

DSM - Create Task
DSM – Create Task

Switch over to the Schedule tab and click on the down arrow on “Run on the following days” below the Date section and set it to “Weekend” and then uncheck Sat. This will set it to run on Sundays only. You can leave the rest on defaults.

DSM - Schedule Task
DSM – Schedule Task

Click on the OK button. With this, we now have our Synology automatically run the gitupdate.sh script every Sunday Midnight. This script will then take care of updating nzbToAniDB if there are updates.

Keep Task Scheduler open (not done here yet – so just minimize it so it’s out-of-the-way) and lets setup nzbToAniDB. This will require an aniDB.net account.

At the moment, anidb.net is down (the reason why this tutorial was not updated sooner), so guess I’ll have to wait until then to create that part of the guide. Check back later for updates.

And they are back (that didn’t take too long)! Create an account (if you already have one, skip this part). You will need an account to complete this tutorial and get your anime collection growing – and honestly, if you don’t already have one, you are missing out!

Once your account is activated (check your email), make a note of your username and password (we will need it for the next step). You can do the next part with a text editor via DSM or by browsing with a computer into the nzbToAniDB folder.

In this folder, look for a file named anidb.cfg.default, create a copy of this file and rename it to anidb.cfg. Go ahead and open it with a Text Editor of some sort (not a Rich Text editor – Notepad will do the job on Windows and I recommend TextWrangler on OS X).

Don’t be intimidated by this file, it’s pretty self-explanatory, but let me break it down.

  • Each section is separated by a header surrounded by brackets ([ ]).
  • Each item under each section DOES NOT need to be filled in.
  • Item names are followed by an equals sign (=), then the value itself (you need to provide this value).

For each item that needs to be filled in, you will be setting your cursor a few spaces after the equal sign (spaces already exist on the file, just set your cursor there with your mouse).

  • On the AniDB section, set your cursor a few spaces after the equals sign on the username item. This is where you set the username you used with anidb.net to sign up, so go ahead and type that in.
  • Right below that, type in your password for anidb.net in the password item after the equals sign (yes, this has now become a private file, don’t go around sharing it).
  • Underneath that, the suffix field, you can add the video extension types that the script will look at. These are generally the most commonly used and don’t need to be changed.
  • The next two should be self-explanatory, they let us set where the files will be moved to once renamed. The directory item pertains to ‘Anime’ as a whole (this means anything that is Anime MINUS Anime Movies) and the directorymovie item pertains to anime movies only. I generally set these two to have the same value, but if you want your anime movies separate from anime series, anime OVAs, etc., then set directorymovie accordingly. If you already have an anime folder, then set these two fields to the absolute path of that folder. If your Synology only has one volume, then this path will start with /volume1. Then the name of the share will follow; we named that anime so the path to this share becomes /volume1/anime/. Add a trailing slash at the end for consistency and to reduce the number of errors with weird files and folder names when dealing with scripts. In summary, in my case, and if you are following this guide – you as well, set directory and directorymovie fields to /volume1/anime/.

The next two sections (Plex and XBMC) are not needed for our purpose and can simply be left as is.

Let me explain what is going on in the rename section:

When a fansub group releases anime on to the wild (word of the web), they tag each release accordingly. An example would be as follows:

[HorribleSubs] Tribe Cool Crew - 16 [1080p].mkv

The renamer itself does not care how the file is named (it uses hashes to know what file it is dealing with), but it needs to know what tags you are interested in so that it can rename each file how you prefer. If you want to know more about the renamer, check out the readme file in the nzbToAniDB folder or this page.

To get you started, just use my preferred tags:

TVFormat = %ATr% - %EpNo%%Ver% - %ETe% - [%GTs%][%Source%](%FCRC%)
MovieFormat = %ATr% - %EpNo% - [%GTs%][%Source%](%FVideoRes%)(%FCRC%)
OVAFormat = %ATr% - %EpNo% - [%GTs%][%Source%](%FVideoRes%)(%FCRC%)
folderName = %ATr%

Just replace the items with the values you see above. The rest of the items in this section are left with the default values.

The final section, integration, just replace it with my values as well:

nzbToAnidb_switches = --recursive --rename --move --add --watched

This will ensure the following:

  • Any file and folders with files that match the suffix set in the AniDB section will be hashed and checked against the anidb.net database.
  • If the hash value of said file matches, then the data for that file will be downloaded and applied to the file according to the tags set in the TVFormat item if it is an anime episode (but not a movie nor an OVA). The same conditions apply to Movies and OVAs accordingly.
  • Once that data is applied, the file will be moved to the folder set in the directory item if it is an Anime, OVA, etc., directorymovie if it is a movie.
  • The episode will be added to your anime list in anidb.net for tracking and will mark it as watched (you can remove either of these two if you don’t need either of these – I recommend leaving --add on there).

It is now time to see if you have configured it all correctly. Check your download folder and look in the completed anime folder. If you configured Download Station properly (grabbed your private RSS link and set to download all on the filters) and sent a release from shanaproject.com, then you will see a file or two in there. If that is not the case, open Download Station and see if they are in the download list. Open the RSS Feeds and make sure your link is correct. Finally, make sure you actually sent a release (the entry in shanaproject.com for sent releases look dimmer than entries that have not been sent to your private RSS feed).

Got a file downloaded? Restore your terminal application and run the following:

python /volume1/auto/nzbToAniDB/nzbToAniDB.py /volume1/downloads/completed/anime/

What are we doing here? The script is a python application so we use python to run it. We give python the path to the script and then the path that we want to check. Python takes care of running our script and the path to our completed anime downloads. From there, the script will take care of the rest.

If everything is working, you should see something like the following:

OS X - Terminal
OS X – Terminal

Do not worry too much about the unknown file. A few groups will take a few days to add their releases to anidb.net and the hash will not match their database. Groups like HorribleSubs are a good example of this (they are a speed subbing group, meaning they try to get out releases as fast as they come out, and so fall behind updating anidb.net – there is a lot of anime out there).

If you got a good number of files recognized, then they will be renamed and moved to your anime folder. Go ahead and go to that folder.

So? Is everything in there?

Let’s add the last touch. Restore the Task Scheduler in DSM and create a new User-defined script. Name it “Organize Anime” and add the previous command to the Run command section:

python /volume1/auto/nzbToAniDB/nzbToAniDB.py /volume1/downloads/completed/anime/

DSM - Create Task
DSM – Create Task

Switch over to the Schedule tab and under the Time section, change the Frequency to every 4 hours (you can go lower than this, but I do not recommend going lower than 2 hours). Set the last run time as close to the actual time if you want the task to start as soon as those 4 hours are up.

DSM - Schedule Task
DSM – Schedule Task

Click on OK to complete those changes and enjoy not having to manually organize your anime collection ever again!

If you have any other questions not covered by this guide, or if something is not as clear as it needs to be, go ahead and make use of the comments section below. If you have a task you always repeat when taking care of your anime and would love to automate it, send me a word via the feedback page.


Featured Image Credit:

Hatsune Miku, Hisahi (Hisashi), pixivid 119045, Vocaloid | Source