# Filebot presets for Mangrana
## Motivation
This project relies on the [Filebot renaming tool](https://www.filebot.net/), and it aims to automatically classify the content on the different libraries that are presented to the user. This lets him hide the ones which is not interested in (i.e. Asian films?) and choose much easier what he wish to watch (i.e. spanish TV shows).

Here you can see a demonstration:

![Retro](misc/retro_library_showcase.png)

It does not only treats the genres but also the ages. For example, it locates 80' and 90' movies in a library called Retro, but not in case of they are kids movies (along many others)

![Kids](misc/kids_library_showcase.png)

Also, it renames the files in a way that I decided.
Here, for example the download movie file was: 

><em>data/torrents/movies/<br>**Akira.1988.mHD.10Bits.1080p.BluRay.DD5.1.x265-TMd**.mkv</em>

And my script had rename it to this:
><em>/data/media/movies/Pelis_Anime/main/<br>Akira (1988) {tmdb-149}/<br>**Akira (1988) [HEVC microHD BluRay 7.1M 23.976f][spa+, jpn+, eng DD 5.1][spa+, eng+, jpn]{tmdb-149}**.mkv</em>

Showing in the same name: the codec, distribution format, quaity, bitrate, framerate, audios specifying its type (DolbyDigital, etc) and how many channels, subtitles including which ones has more than one version for the same language and the TheMoveDB id. Cool, isn't it?

The same with the TV shows. Here an example

><em>data/torrents/tv/<br>Childhood's End (2015) temporada 1/<br>**El fin de la infancia - 1x01 - Los amos**.mkv</em>

to:
><em>data/media/tv/Series/new/<br>Childhood-s End (2015) {tvdb-296065}/Temporada 01/<br>**El fin de la infancia (2015) - S01E01 - Los amos [HEVC microHD 1.7M 23.976f][spa DD 2.0, eng DD 5.1][spa, eng]**.mkv</em>

Lovely

## The code
Ok, here is a bit crazy, because the best way I found to reuse certain parts of the script was literally cutting it in different files that are needed to put together in a concrete order to get them work. Just like:

```
MoviesRootScript.groovy
└───@MovieScipt.groovy
│   │   def greetings = "hello movies!"
│   │   try {
│   
└───@CommonScipt.groovy
    │     print(greetings)
    │   } catch (Exception e) {}
```
```
SeriesRootScript.groovy
└───@SerieScipt.groovy
│   │   def greetings = "hello tv shows!"
│   │   try {
│   
└───@CommonScipt.groovy (reused)
    │     print(greetings)
    │   } catch (Exception e) {}
```
Crazy, but funny, and effective.

### The quality
And sorry, Groovy is not my language, actually I didn't write groovy ever before, and also didn't plan to make it public when I wrote it, so please bear it in mind before jutge the code quality of this :-)