1.
Let's start by making the format human-readable:
Code: Select all
{
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/)
}
/** This is the "Is It Wrong To Try To Pick Up Girls In A Dungeon!" part **/
return norm(n)
}
{
if (norm(n) != norm(primaryTitle)) {
/** This is the "Dungeon Ni Deai O Motomeru No Wa Machigatte Iru Darouka - Familia Myth" part **/
return ' (' + norm(primaryTitle) + ')'
}
}
{
/** This is the optional "3D" part **/
fn.contains('3D') || fn.contains('3-D') ? ' 3D': null
}
/{norm(n)} - {s00e00.pad(episodelist.size() < 99 ? 2 : 3)}{'Special '+special.pad(episodelist.size() < 99 ? 2 : 3)} - {norm(t)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|special[ ._-]edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[.]/, " ") + ')'}{" Part $pi"}{" [$vf $vc $ac $af]"}"

I've only refactored the first few
{expressions} that are responsible for the series level folder name. I recommend fixing up the rest like I did so that you can read it.
2.
Now that we can easily distinguish which section of the code does what, you can simply remove the "original title" part and the "3D" part from the format, so that the series level folder name is always just the series name:
Code: Select all
{
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/)
}
/** This is the "Is It Wrong To Try To Pick Up Girls In A Dungeon!" part **/
return norm(n)
}
/{norm(n)} - {s00e00.pad(episodelist.size() < 99 ? 2 : 3)}{'Special '+special.pad(episodelist.size() < 99 ? 2 : 3)} - {norm(t)}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':""}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|special[ ._-]edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[.]/, " ") + ')'}{" Part $pi"}{" [$vf $vc $ac $af]"}"