A nice automatic system that handles your Anime.

First of all, I would like to point out that it’s not fully automatic… you have to search for your Anime titles and make sure that they end up in the correct folder. However, once downloaded, this system will move your Anime to the correct folder, in the correct format.

So, the annoying part of Anime is that they use an unique way of numbering these Anime. I have written a script that attempts to transform these ways of numbering to something that XBMC can use. There are some limitations to what this script can do and there will be frequent updates to this script since I’m actively watching Anime (yes, it’s a curse…).

Requirements

Well, they’re the same as: The Automatic Downloading System. As a matter of fact, this script is based on, well hacked from, the series-complete script. I kept them separate because the way both scripts handle episodes became quite different.

Preparation

Well, just make sure you have Perl, and those libraries I use.

Download my script:

cd /usr/local/bin
wget https://danielsoncksolutions.nl/scripts/anime-complete
chmod ugo+rx anime-complete

And use the powerful system I discovered in XBMC:

Add a new source, use TheTVDB as scraper but configure it to use absolute numbering. And yes, this setting apparently is a per source setting. So you can set different options for your TV Shows (if you followed my automatic system) and Anime titles.

Usage

Well, add a useful line to your crontab:

0 * * * * /usr/local/bin/anime-complete --cron

Here comes the tricky bit. Just write this down somewhere… Every single Anime title should go into the folder /home/transmission/Downloads/Complete/Anime/<anime title> [<anime season>]/. No exceptions! You have to manually specify the location of every Anime.

Perhaps some explaining:

This script you’re about to use handles Anime titles by looking at the directory name in the download folder (just as my TV Show script). But if it finds a number between square brackets ([]) in the name it will assume that it’s a season. What is a season… well, it just says to the script, we start counting from 1 again.

So how is this useful? Since a lot (or perhaps just a few… but certainly enough) Anime titles count into the hundreds when numbering their episodes (and know nothing about seasons), this script simplifies it’s job by doing the same. And here is the trick, TheTVDB can understand this (absolute) numbering. But since there are Anime titles which start over with their numbering (Minami-ke), this script needs to calculate the absolute numbering. And that’s exactly what it does when it handles multiple seasons. When it encounters [1], it will remember the last episode number of season 1. Once it encounters [2], it will add the total of season 1 to the episode number and remember the new total. And what was a bug now remains as a feature, it uses every file to get to the total. So if you download using transmission and it includes .part in the filename, it won’t hardlink the file but will count the episode. This allows the next seasons to have the correct absolute numbering even if the current season isn’t complete yet.

But since transmission also doesn’t create files until it downloads them, this script calculates a hash that is the same as the OpenSubitles Hash. It uses this to see if the numbering has shifted. If for example episode 13 has started downloading, episode 1 of the next season will move from 13 to 14. Since the hash isn’t the same for the old episode 13, it will erase it and put the new (correct) episode in it’s place. This goes on for every episode that should move.

Words of caution

Well, it won’t eat your kittens… but it’s quite picky. Just make sure you follow these rules:

  • If there are two files with the same episode number, there is no telling (well actually the first one that is found will be linked) which one is going to end up linked. Just make sure it doesn’t happen.
  • It always uses ## as an episode number so make sure that the number that can be found, is actually an episode number

Fancy stuff

Currently it supports these fancy things:

  • Removes every ‘information tag’ I discovered (H264, Hi10, 1080p, etc.)
  • Removes the same release groups as the series-complete script
  • Transforms S(eason)(. )## and E(p(isode))(. )##
  • Detects OVA, (NC)ED and (NC)OP, these are stored differently from episodes

Followup: The automatic Anime and TV Shows download system improvement