Match multi-episode out-of-order cartoon episodes by title
Posted: 08 Jun 2021, 06:18
Cartoons are often aired out-of-order and in groups comprised of 3-4 individual episodes per airdate. If the episode numbering and grouping you have does not match TheTVDB or TheMovieDB at all, then automatically matching files to episode information is nigh impossible.
e.g. ChalkZone
e.g. Daniel Tiger's Neighborhood
If the series at hand has episodes without airdate (i.e. missing or incomplete episode information) or special episodes aired on the same date as regular episodes then you may need to further refine your --mapper expression like so for the best results:
GUI: Fabricate multi-episode items in the Episodes tool
If you are using the FileBot Desktop application and struggling with multi-episode files, then please follow the How do I manually match multi-episode files in linear order? video tutorial to make quick work of the task at hand.CLI: Fabricate multi-episode items with the --mapper option
If you are using the filebot command-line tool, then a smart --mapper expression might just do the trick, e.g. match-by-title and format-by-mapping where each individual episode is mapped to a combined multi-episode group per airdate:Groovy: Select all
episode
.number(null)
.map(episodelist.findAll{ airdate == it.airdate }.episode)
.reverse()
e.g. ChalkZone
Console Output: Select all
$ filebot -rename *.mkv --db TheTVDB -non-strict --format "{plex.name}" --mapper "episode.number(null).map(episodelist.findAll{ airdate == it.airdate }.episode).reverse()"
[MOVE] from [ChalkZone.S01E01.Rudys.First.Adventure.Rudys.Story.Bushel.Full.of.Yum.mkv] to [ChalkZone - S01E01-E03 - Rudy's First Adventure & Rudy's Story & Bushel Full of Yum.mkv]
[MOVE] from [ChalkZone.S01E02.SnapMobile.Rudys.First.Date.Future.Zone.mkv] to [ChalkZone - S01E04-E07 - SnapMobile & Rudy's First Date & Future Zone & Mumbo Jumbo Jump.mkv]
[MOVE] from [ChalkZone.S01E03.The.Wiggies.Rapunzel.Hair.To.Stay.Coming.To.Life.mkv] to [ChalkZone - S01E19-E22 - The Wiggies & Rapunzel & Hair To Stay & Coming To Life.mkv]
e.g. Daniel Tiger's Neighborhood
Console Output: Select all
$ filebot -rename *.mp4 --db TheTVDB -non-strict --format "{plex.name}" --mapper "episode.number(null).map(episodelist.findAll{ airdate == it.airdate }.episode).reverse()"
[MOVE] from [Daniel Tiger's Neighborhood_S06E01_Miss Elaina Gets Hurt_Daniel Feels Better.mp4] to [Daniel Tiger's Neighborhood - S02E18-E19 - Miss Elaina Gets Hurt & Daniel Feels Better.mp4]
[MOVE] from [Daniel Tiger's Neighborhood_S06E02_Daniel Can't Ride Trolley_Daniel Can't Get What He Wants.mp4] to [Daniel Tiger's Neighborhood - S02E20-E21 - Daniel Can't Ride Trolley & Daniel Can't Get What He Wants.mp4]
[MOVE] from [Daniel Tiger's Neighborhood_S06E03_Nighttime in the Neighborhood.mp4] to [Daniel Tiger's Neighborhood - S02E22 - Nighttime in the Neighborhood.mp4]

Groovy: Select all
any{
if (regular) {
episode.number(null)
.map(episodelist.findAll{ airdate == it.airdate && !it.special }.episode)
.reverse()
}
}{
episode.number(null)
}