[AMC] Remapping Episodes

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Joon
Donor
Posts: 62
Joined: 05 Apr 2014, 14:13

[AMC] Remapping Episodes

Post by Joon »

Hi there,

For split cour anime (split seasons) it frequently happens that the second season will have a different name and thus a new anidb entry.
For example http://anidb.net/perl-bin/animedb.pl?sh ... &aid=10813 and http://anidb.net/perl-bin/animedb.pl?sh ... &aid=10984
The latter one is S2 in this case.

However the releaseformat for episodes in the second season continue from where season one left off so season one would be 1-12 and season two 13-24.
This screws up, because aniDB has the episodes listed for 1-12 for season two and not 13-24.

What is the best way of dealing with this (with AMC) ?
This happens once or twice every single season and i've just been renaming them manually.

Regards,

Jonathan
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [AMC] Remapping Episodes

Post by rednoah »

If the information in the filename doesn't correlate to what's in in the database then things get tricky, and generally don't work.

Depending on the exact situation, and your setup, you can make it work with -non-strict mode and using an age filter. If you're using the amc script, see Advanced Fine-Tuning.
:idea: Please read the FAQ and How to Request Help.
skullzy
Power User
Posts: 50
Joined: 07 Jan 2015, 22:19

Re: [AMC] Remapping Episodes

Post by skullzy »

I ran a manual search in filebot for Owari no Seraph, just to see what it would display

This was the results

Code: Select all

1X01 The World's Bloodline
1X02 Humanity After Ruination
1X03 The Demon Lives in Your H
1X04 Vampire Mikaela
1X05 Contract With the Black D
1X06 A New Family
1X07 Mitsuba's Team
1X08 Beginning of the Annihila
1X09 Vampire Attack
1X10 Result of the Selection
1X11 Reunion of Old Playmates
1X12 Everyone's a Sinner
2X01 The Human's World << this would be Episode 13
2X02 Mixed Relationship << This would be Episode 14
2X03 Episode 3
2X04 Episode 4
2X05 Episode 5
2X06 Episode 6
2X07 Episode 7
2X08 Episode 8
2X09 Episode 9
2X10 Episode 10
2X11 Episode 11
2X12 Episode 12
1X Seraph of the Endless
1X Seraph of the Endless 2
1X Seraph of the Endless 3
1X Seraph of the Endless 4
2X The Beginning of the End
2X Jump Festa 2015 Special
Now I ran another manual search, this time I included --filter "(age < 2)" since the next episode aires today and that would be episode 14 according to you.

I then added the followeding format {(s-1.pad(2))}X{(e+12).pad(2)} {t} which deducted a season and added 12 to the episode. The result was the following.

Code: Select all

C:\Users\Plex>filebot.exe -list --q "Owan no Seraph" --format "{s-1}X{(e+12).pad(2)} {t}" --filter "(age < 2)"
1X14 Mixed Relationship
if you wanted this to show 01x14 you would add padding to s-1 "{(s-1).pad(2)}X{(e+12).pad(2)} {t}"

Would this be something you'd be looking for? you could change the format to your own, as long as you used (s-1) and (e+12) were you'd want the episode and or season number to appear.. to add a leading zero simply stick .pad(2).

To do this though you'd need to have a label or something set-up for that anime series in whatever you're using to download the anime, and it also depends on how you're calling the filebot script, if you're using bash, batch or some other method then you could do an if else statement to add that format for that series..

something like

Code: Select all

if label = OnoSeraph do the following
   FormatAnime ="/Path/Anime/{(s-1).pad(2)}X{(e+12).pad(2)} {t}"
Else
   FormatAnime ="/Path/Anime/What Ever Your Format Is"

filebot -script fn:amc [your script] animeformat=FormatAnime
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [AMC] Remapping Episodes

Post by rednoah »

1.
Yes, the --filter allows you to exclude all bad matches, and thus force a single match, that will remain as the best/only match regardless of episode numbers.

2.
I wouldn't mess with season/episode numbers in the format. It'll just make things harder next time you process these files when a simple age filter isn't applicable anymore. I recommend forcing your files to conform to whatever AniDB says, not the other way around.

3.
Just add --filter "age < 5" to the amc call and see what happens. I'd start with that. No need to worry about labels in this first step.

If the age filter is working, then you can think about maybe only applying the age filter for certain labels.
:idea: Please read the FAQ and How to Request Help.
Joon
Donor
Posts: 62
Joined: 05 Apr 2014, 14:13

Re: [AMC] Remapping Episodes

Post by Joon »

First of all, apologies for taking so long to get back to this.
skullzy wrote:I ran a manual search in filebot for Owari no Seraph, just to see what it would display

This was the results

Code: Select all

1X01 The World's Bloodline
1X02 Humanity After Ruination
1X03 The Demon Lives in Your H
1X04 Vampire Mikaela
1X05 Contract With the Black D
1X06 A New Family
1X07 Mitsuba's Team
1X08 Beginning of the Annihila
1X09 Vampire Attack
1X10 Result of the Selection
1X11 Reunion of Old Playmates
1X12 Everyone's a Sinner
2X01 The Human's World << this would be Episode 13
2X02 Mixed Relationship << This would be Episode 14
2X03 Episode 3
2X04 Episode 4
2X05 Episode 5
2X06 Episode 6
2X07 Episode 7
2X08 Episode 8
2X09 Episode 9
2X10 Episode 10
2X11 Episode 11
2X12 Episode 12
1X Seraph of the Endless
1X Seraph of the Endless 2
1X Seraph of the Endless 3
1X Seraph of the Endless 4
2X The Beginning of the End
2X Jump Festa 2015 Special
Now I ran another manual search, this time I included --filter "(age < 2)" since the next episode aires today and that would be episode 14 according to you.

I then added the followeding format {(s-1.pad(2))}X{(e+12).pad(2)} {t} which deducted a season and added 12 to the episode. The result was the following.

Code: Select all

C:\Users\Plex>filebot.exe -list --q "Owan no Seraph" --format "{s-1}X{(e+12).pad(2)} {t}" --filter "(age < 2)"
1X14 Mixed Relationship
if you wanted this to show 01x14 you would add padding to s-1 "{(s-1).pad(2)}X{(e+12).pad(2)} {t}"

Would this be something you'd be looking for? you could change the format to your own, as long as you used (s-1) and (e+12) were you'd want the episode and or season number to appear.. to add a leading zero simply stick .pad(2).

To do this though you'd need to have a label or something set-up for that anime series in whatever you're using to download the anime, and it also depends on how you're calling the filebot script, if you're using bash, batch or some other method then you could do an if else statement to add that format for that series..

something like

Code: Select all

if label = OnoSeraph do the following
   FormatAnime ="/Path/Anime/{(s-1).pad(2)}X{(e+12).pad(2)} {t}"
Else
   FormatAnime ="/Path/Anime/What Ever Your Format Is"

filebot -script fn:amc [your script] animeformat=FormatAnime
Thank you for going so deep on this, but unfortunately for your example, i do not think you used AniDB in this case.
The reason it's not working is because they're actually separate shows on AniDB with different titles.
This is still very useful information though in terms of automating the process, i would just have to determine how many episodes it will have to deduct from the input.
rednoah wrote:1.
Yes, the --filter allows you to exclude all bad matches, and thus force a single match, that will remain as the best/only match regardless of episode numbers.

2.
I wouldn't mess with season/episode numbers in the format. It'll just make things harder next time you process these files when a simple age filter isn't applicable anymore. I recommend forcing your files to conform to whatever AniDB says, not the other way around.

3.
Just add --filter "age < 5" to the amc call and see what happens. I'd start with that. No need to worry about labels in this first step.

If the age filter is working, then you can think about maybe only applying the age filter for certain labels.
Thank you, i'll give that a shot first.

I am already filtering though, do i just add "age < 5" behind that ?

Code: Select all

--filter "label =~ info.id" "age < 5"
Because if i do the above it goes horribly wrong.

If i put "&&" in between, it does process but the age filter is not shown in the logs nor does it seem to be working.
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [AMC] Remapping Episodes

Post by rednoah »

The --filter option will only allow you to pass in one single argument, and that can be a more complex expression. Boolean operators like && and || most definitely work.


GOOD:

Code: Select all

--filter "label =~ info.id && age < 5"

BAD:

Code: Select all

--filter "label =~ info.id" && "age < 5"
What you say doesn't make sense, so I guess you're doing something that doesn't make sense. If you're doing something like this, then you need to learn how the shell works first. ;)
:idea: Please read the FAQ and How to Request Help.
Joon
Donor
Posts: 62
Joined: 05 Apr 2014, 14:13

Re: [AMC] Remapping Episodes

Post by Joon »

rednoah wrote:The --filter option will only allow you to pass in one single argument, and that can be a more complex expression. Boolean operators like && and || most definitely work.


GOOD:

Code: Select all

--filter "label =~ info.id && age < 5"

BAD:

Code: Select all

--filter "label =~ info.id" && "age < 5"
What you say doesn't make sense, so I guess you're doing something that doesn't make sense. If you're doing something like this, then you need to learn how the shell works first. ;)
Yeah i only dabble in shell, and i wasn't really sure how filebot dealt with multiple filter arguments.
FYI i tried the bad example first, hence why it didn't work.

Code: Select all

Run script [fn:amc] at [Thu Apr 21 13:40:37 CEST 2016]
Parameter: ignore = (?i)Programs
Parameter: clean = y
Parameter: ut_dir = /home/sbuser/rtorrent/downloads/Anime/Gakusen Toshi Asterisk (2016)/[HorribleSubs] Gakusen Toshi Asterisk - 15 [480p].mkv
Parameter: ut_kind = multi
Parameter: ut_title = [HorribleSubs] Gakusen Toshi Asterisk - 15 [480p].mkv
Parameter: ut_label = Anime 11673
Input: /home/sbuser/rtorrent/downloads/Anime/Gakusen Toshi Asterisk (2016)/[HorribleSubs] Gakusen Toshi Asterisk - 15 [480p].mkv
Group: [anime:gakusen toshi asterisk 2016] => [[HorribleSubs] Gakusen Toshi Asterisk - 15 [480p].mkv]
Rename episodes using [AniDB]
Auto-detected query: [gakusen toshi asterisk 2016, gakusen toshi asterisk]
Fetching episode data for [Gakusen Toshi Asterisk (2016)]
Fetching episode data for [Gakusen Toshi Asterisk]
Apply Filter: {label =~ info.id && age < 6}
Include [The Asterisk War: 2nd Season - 03 - Breaking the Memory Barrier]
[HARDLINK] Rename [/home/sbuser/rtorrent/downloads/Anime/Gakusen Toshi Asterisk (2016)/[HorribleSubs] Gakusen Toshi Asterisk - 15 [480p].mkv] to [/home/sbuser/downloads/Anime/Gakusen Toshi Asterisk (2016)/Gakusen Toshi Asterisk (2016) - 03 - Breaking the Memory Barrier.mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
Used this episode as a test, i raised the age to 6 in this case because it aired on the 16th, but it did work!
Downloading as-airs episodes will probably allow me to restrict the age filter a bit more probably around 2-3.


Thanks for the help, i really appreciate it!
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [AMC] Remapping Episodes

Post by rednoah »

Assuming there is only one episode per week, setting the age filter to anything less than a week should be fine, as there will only ever be one possible episode left after the filter has been applied.
:idea: Please read the FAQ and How to Request Help.
Post Reply