Hey,
i encrypt files renamed by filebot which inflates the file name length. To avoid hitting the maximum file length, I need to cut the total file name length to around 165 while still keeping some parts of the file name intact, like a custom suffix and of course the file extension.
Example:
SERIES_FORMAT='TV Shows/{n}/{episode.special ? "Special" : "Season "+s.pad(2)}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /"/).replaceAll(/[!?.]+\$/).replacePart(", Part \$1")} {" [$vf, $vc, $ac]"}{"-"+group}{"."+lang}'
In this case 'TV Shows/{n}/{episode.special ? "Special" : "Season "+s.pad(2)}/{n} - {episode.special ? "S00E"+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /"/).replaceAll(/[!?.]+\$/).replacePart(", Part \$1")}' should be cut to 165 - length of '{" [$vf, $vc, $ac]"}{"-"+group}{"."+lang}'.
Is there any way to do that?
Thanks!
Trim to maximum file name size but keep suffix
Re: Trim to maximum file name size but keep suffix
The episode title t is probably the only part of that format that can have an unpredictable length, so I'd just limit the character length of t.
e.g. limit title to 100 characters:
e.g. limit title to 100 characters:
Code: Select all
t.take(100)