Custom preset to rename videos and subtitles

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
kiwichick
Posts: 12
Joined: 26 Jul 2022, 22:23

Custom preset to rename videos and subtitles

Post by kiwichick »

I have two custom presets that I use - one for renaming video files and one for renaming subtitle files. Is it possible to have FB do both in a single preset?

This is the script for renaming the video files:

Code: Select all

{n.removeAll(/[!?.]+$/).colon(', ')} ({y}) - {s00e00} - {t.removeAll(/[!?.]+$/).colon(', ').replace('(1)', '(Part 1)').replace('(2)', '(Part 2)').replace('(3)', '(Part 3)')}
The subtitle script is the same but with .eng on the end.

EDITED TO ADD: If it makes things easier, I'm renaming only srt subtitle files.
User avatar
rednoah
The Source
Posts: 23199
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Custom preset to rename videos and subtitles

Post by rednoah »

Just add {subt} at the end. It'll work for both video files and subtitles files because {subt} is only defined for subtitle files:

Format: Select all

{n.removeAll(/[!?.]+$/).colon(', ')} ({y}) - {s00e00} - {t.removeAll(/[!?.]+$/).colon(', ').replacePart(' (Part $1)')}{subt}
:arrow: {lang} and {subt} subtitle language tag
:idea: Please read the FAQ and How to Request Help.
kiwichick
Posts: 12
Joined: 26 Jul 2022, 22:23

Re: Custom preset to rename videos and subtitles

Post by kiwichick »

rednoah wrote: 26 Jun 2024, 04:24 Just add {subt} at the end. It'll work for both video files and subtitles files because {subt} is only defined for subtitle files:

Format: Select all

{n.removeAll(/[!?.]+$/).colon(', ')} ({y}) - {s00e00} - {t.removeAll(/[!?.]+$/).colon(', ').replacePart(' (Part $1)')}{subt}
:arrow: {lang} and {subt} subtitle language tag
Perfect! Thank you very much.
Post Reply