[DOCS] Use --mapper expressions for AniDB / TheTVDB cross-entity matching

How-to guides, frequently asked questions, not-so-obvious features, etc
Post Reply
User avatar
rednoah
The Source
Posts: 16812
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

[DOCS] Use --mapper expressions for AniDB / TheTVDB cross-entity matching

Post by rednoah » 12 Aug 2019, 13:11

(requires FileBot 4.8.6 or higher) The --mapper option accepts a Groovy expression that yields Episode or Episode[] to map one episode object to one or more episode objects to be used for matching. It's based on the same FileBot Format Engine used for --filter and --format expressions, so code and episode bindings work exactly the same.


e.g. use and rename with TheTVDB episode data, but use AnimeList.AniDB episode mappings for matching:

Code: Select all

filebot -rename *.mkv --db TheTVDB --mapper AnimeList.AniDB

e.g. force Match by Episode Title or Match by Episode Airdate by nullifying SxE numbers:

Code: Select all

episode.derive(0, 0)



Example Mapper Expressions:




Advanced Example Mapper Expressions:
  • Map to itself:
    (i.e. identity mapper, behave exactly as if there was no mapper)

    Code: Select all

    episode
  • Force Season 1 / Episode e+1 and match accordingly:
    (e.g. useful if all SxE numbers are off by 1 for some reason)

    Code: Select all

    episode.derive(1, e + 1)
  • Use a different mapper depending on some condition:
    (e.g. use AniDB mapper if the Anime label is set, otherwise use identity mapper)

    Code: Select all

    label =~ /Anime/ ? AnimeList.AniDB : episode
  • Map to multiple episodes at the same time, in the hope that one of these additional options matches your files, and let the matcher figure out the rest:
    (e.g. useful if you don't know what you're dealing with in advance and want FileBot to consider multiple possibilities)

    Code: Select all

    [episode, AnimeList.AniDB, XEM.AniDB]

:idea: You can use the Format Editor to test and prototype --mapper expressions.
:idea: Please read the FAQ and How to Request Help.

Post Reply