Mapping AniDB numbers to TheTVDB numbers doesn't always work

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
Azazelbishop
Posts: 2
Joined: 14 Oct 2021, 21:03

Mapping AniDB numbers to TheTVDB numbers doesn't always work

Post by Azazelbishop »

Hi i'm having a problem where some anime that i download gets renamed to mkv instead of the anime name and episode it works for the most part just the odd anime gets renamed to mkv. any help would be great thanks.

here is a test run

Code: Select all

E:\>filebot -script fn:amc "E:\other\New Downloads" --output E:\other --log-file amc.log --action move --conflict skip -non-strict --def clean=y --def [email protected]:\other\SeriesFormat.groovy  [email protected]:\other\AnimeFormat.groovy  [email protected]:\other\MoviesFormat.groovy --def music=n artwork=n "ut_label=S" "ut_title=K" "ut_file=D" --def emby=localhost:7f7aa33581b1486280061f488aaa5aa2 --action TEST
Run script [fn:amc] at [Thu Oct 14 14:54:00 MDT 2021]
Parameter: clean = y
Parameter: seriesFormat = TV Shows\{n}/{'Season '+s}/{n} - {s00e00} - {t}
Parameter: animeFormat = tv shows\{n}/{'Season '+s}/{db.TheTVDB.emby[3]}
Parameter: movieFormat = {vf == /2160p/ ? '4k Movies' : 'Movies'} \{collection.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/).replaceFirst(/^(?i)(Collection of the)\s(.+)/, /$2 Collection/).replaceAll(/Saga Collection/, "Saga").replaceAll(/[`´???""??]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ")}\{norm = {it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/[`´???""??]/, "'").replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!").replaceAll(/[*\s]+/, " ").replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:th|nd|rd)\b/, { it.lower() }).replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}; norm(n)}{if (norm(n) != norm(primaryTitle)) ' ('+norm(primaryTitle)+')'}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""} ({y} {hd} {certification}) [{vf}]/{norm(n)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ')'}{" Part $pi"} ({y}){" [$vf $vc $ac $af]"}
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = S
Parameter: ut_title = K
Parameter: ut_file = D
Parameter: emby = *****
Argument[0]: E:\other\New Downloads
Ignore hidden: E:\other\New Downloads\desktop.ini
Input: E:\other\New Downloads\New Tv\[SubsPlease] Scarlet Nexus - 16 (720p) [78360D2D].mkv
Group: {Anime=scarlet nexus} => [[SubsPlease] Scarlet Nexus - 16 (720p) [78360D2D].mkv]
Rename episodes using [AniDB] with [Absolute]
Lookup via [Scarlet Nexus]
Fetching episode data for [Scarlet Nexus]
Stripping invalid characters from new path: tv shows/Scarlet Nexus/
[TEST] from [E:\other\New Downloads\New Tv\[SubsPlease] Scarlet Nexus - 16 (720p) [78360D2D].mkv] to [E:\other\tv shows\Scarlet Nexus\mkv]
User avatar
rednoah
The Source
Posts: 20316
Joined: 16 Nov 2011, 08:59

Re: script remaning to mkv

Post by rednoah »

This is your Anime format,

Code: Select all

tv shows\{n}/{'Season '+s}/{db.TheTVDB.emby[3]}
and based on the output path,

Code: Select all

E:\other\tv shows\Scarlet Nexus\mkv
we can deduce that {'Season '+s} and {db.TheTVDB.emby[3]} failed to yield a value. This is entirely expected since mapping AniDB ➔ TheTVDB information isn't always possible, and probably won't work reliably for less popular series, or brand new episodes.


:arrow: You may prefer --db animeDB=TheTVDB if --db animeDB=AniDB (default) isn't well-suited for the files at hand or the information you need to get the destination file paths you want.
:idea: Please read the FAQ and How to Request Help.
Azazelbishop
Posts: 2
Joined: 14 Oct 2021, 21:03

Re: Mapping AniDB numbers to TheTVDB numbers doesn't always work

Post by Azazelbishop »

E:\other\tv shows\Scarlet Nexus\ is the output path the \mkv was the file name that it renamed it too, what i don't get is when i run the same code from the preset it finds the proper name without me doing anything, i don't know why it would work in the preset but not in a script.

https://photos.app.goo.gl/g6U9Bz4tRba6KCZL8
User avatar
rednoah
The Source
Posts: 20316
Joined: 16 Nov 2011, 08:59

Re: Mapping AniDB numbers to TheTVDB numbers doesn't always work

Post by rednoah »

Your Preset is using Datasource: TheTVDB but the amc script is using --def animeDB=AniDB by default, which in turn changes how {db} works internally, i.e. mapping TheTVDB ➔ TheTVDB does nothing and thus always works, while mapping AniDB ➔ TheTVDB may or may not work depending on the series and available mapping information:

Code: Select all

Rename episodes using [AniDB] with [Absolute]
...

e.g. mapping TheTVDB ➔ TheTVDB

Code: Select all

filebot -list --q "Scarlet Nexus" --db TheTVDB --format "{db.TheTVDB.emby.name}"
Scarlet Nexus (2021) - S01E01 - Scarlet Psionics
Scarlet Nexus (2021) - S01E02 - Scarlet Guardians
...
e.g. mapping AniDB ➔ TheTVDB

Code: Select all

filebot -list --q "Scarlet Nexus" --db AniDB --format "{db.TheTVDB.emby.name}"
Expression yields empty value: Binding "TheTVDB": Mapping not found
Expression yields empty value: Binding "TheTVDB": Mapping not found
...
:idea: Please read the FAQ and How to Request Help.
rv23
Posts: 64
Joined: 19 Jul 2020, 15:05

Re: Mapping AniDB numbers to TheTVDB numbers doesn't always work

Post by rv23 »

As @rednoah has mentioned, sometimes when using a particular DB-to-DB Mapping you might not get a value, one possible way to deal with this is to use the { any { expression1 } {expression2} } in your format code, with your expressions in order of preference. In general as long as one of them works you will at least not get an empty/null string :)

While I don't use filebot to rename the files, I DO use AniDB almost exclusively for looking up the series and creating the series folder using the AniDB name, falling back to the TVDB name if that doesn't resolve (for whatever reason).

Here is the snippet I use for the directory name

Code: Select all

    /
    { any { db.AniDB.n.replaceAll(/\\|\//, '') } { db.AniDB.primaryTitle.replaceAll(/\\|\//, '') } { db.TheTVDB.n.colon(' - ').replaceTrailingBrackets().replaceAll(/\\|\//, '') } { n.replaceAll(/\\|\//, '') } }
    { any { if (db.AniDB.id) '[anidb-' + { db.AniDB.id } + ']' } { if (order.airdate.db.AniDB.id) '[anidb-' + { order.airdate.db.AniDB.id } + ']' } { if (order.absolute.db.AniDB.id) '[anidb-' + { order.absolute.db.AniDB.id } + ']' } { '[tvdb-' + db.TheTVDB.id + ']' } { '[tmdb-' + tmdbid + ']' } }
    / { fn }
My entire format is Current Year Anime goes into YYYY/Season/Series [anidb-xxxx], with not current year into releases/Series [anidb-xxxx] and movies into movies/Movie Name [anidb-xxxx]
The YYYY/Season stuff usually works even :)

If you are interested this is the Series format I'm using: https://github.com/runecalico/filebot-p ... ies.groovy
Post Reply