The Office (US) combined episodes

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

The Office (US) combined episodes

Post by devster »

Some series aired double episodes which in later releases have been combined into one (e.g. The Office US).
In this case I'd have the following list of files:

Code: Select all

The Office S04E01 Fun Run.mkv
The Office S04E02 Dunder Mifflin Infinity.mkv
The Office S04E03 Launch Party.mkv
The Office S04E04 Money.mkv
The Office S04E05 Local Ad.mkv
The Office S04E06 Branch Wars.mkv
The Office S04E07 Survivor Man.mkv
The Office S04E08 The Deposition.mkv
The Office S04E09 Dinner Party.mkv
The Office S04E10 Chair Model.mkv
The Office S04E11 Night Out.mkv
The Office S04E12 Did I Stutter.mkv
The Office S04E13 Job Fair.mkv
The Office S04E14 Goodbye, Toby.mkv
which in reality correspond to the old order listed here https://thetvdb.com/series/the-office-u ... official/4
In short it will be necessary to rename all files corresponding to more than one episode as a multiepisode:

Code: Select all

The Office S04E01 Fun Run.mkv ==> The Office S04E01-02 Fun Run.mkv
The Office S04E02 Dunder Mifflin Infinity.mkv ==> The Office S04E03-04 Dunder Mifflin Infinity.mkv
The Office S04E03 Launch Party.mkv ==> The Office S04E05-06 Launch Party.mkv
The Office S04E04 Money.mkv ==> The Office S04E07-08 Money.mkv
The Office S04E05 Local Ad.mkv ==> The Office S04E09 Local Ad.mkv
[...]
The Office S04E13 Job Fair.mkv ==> The Office S04E17 Job Fair.mkv
The Office S04E14 Goodbye, Toby.mkv ==> The Office S04E18-19 Goodbye, Toby.mkv
A possible solution could be:

Code: Select all

--mapper "episode.number(null).map(episodelist.findAll{ airdate == it.airdate } as net.filebot.web.MultiEpisode).reverse()"
which results in:

Code: Select all

Reverse Map [The Office (US) - Dunder Mifflin Infinity (1)] to [The Office (US) - 4x03 & 4x04 - Dunder Mifflin Infinity]
Reverse Map [The Office (US) - Job Fair] to [The Office (US) - 4x17 - Job Fair]
[TEST] from [/Users/devster/test/The Office US - S04E02 - Dunder Mifflin Infinity.mkv] to [/Users/devster/test/The Office (US) - 4x03 & 4x04 - Dunder Mifflin Infinity.mkv]
[TEST] from [/Users/devster/test/The Office US - S04E17 - Job Fair.mkv] to [/Users/devster/test/The Office (US) - 4x17 - Job Fair.mkv]
Any other ideas?
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: The Office (US) combined episodes

Post by rednoah »

:?: How is your proposed solution not already the solution? Doesn't it already do what you want?


:arrow: The "match multi-episode out-of-order cartoon episodes by title" trick should work in this case.


e.g. works for these 2 representative sample files at least:

Code: Select all

$ filebot -rename *.mp4 --db TheTVDB -non-strict --format "{plex.name}" --mapper "episode.number(null).map(episodelist.findAll{ airdate == it.airdate }).reverse()" --log INFO --action TEST
[TEST] from [The Office S04E13 Job Fair.mp4] to [The Office (US) - S04E17 - Job Fair.mp4]
[TEST] from [The Office S04E14 Goodbye, Toby.mp4] to [The Office (US) - S04E18-E19 - Goodbye, Toby.mp4]
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: The Office (US) combined episodes

Post by kim »

maybe you can use this:

Code: Select all

{n}{ def noPart = {it.replaceAll(/\sPart\s\d|\s\(\d\)/)}; 
def fileSet = episodelist.findAll{ fn.after(s00e00) =~ noPart(it.title) }; 
noPart(fileSet.size() > 1 ? ' - S' + s.pad(2) + 'E' + fileSet.episode.min().pad(2) + '-E' + fileSet.episode.max().pad(2) + ' - ' + fileSet.title.unique{noPart(it)}.join(' & ') : ' - ' + s00e00 + ' - ' + fileSet.title.find()) }
sample file:

Code: Select all

The Office S04E03 Launch Party
out:

Code: Select all

The Office (US) - S04E05-E06 - Launch Party
FYI: it looks like DVD order ;)
Post Reply