[Plain File Mode] How to rename only TV shows in a folder containing shows and movies

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Sydneybrit
Posts: 3
Joined: 18 Jul 2021, 06:32

[Plain File Mode] How to rename only TV shows in a folder containing shows and movies

Post by Sydneybrit »

Hi there

I'm not very experienced in the use of Filebot, so please bear with me!

I currently have a filebot command working to create TV show folder structures in an output folder based on filenames of files in the input folder:

Code: Select all

filebot -rename "C:\Users\xxxx\xxxx\STRM SAMPLE" --action copy --db file --format "C:\Users\xxxx\xxxx\TV SHOWS /{fn.before(/S\d+/)/fn.before(/S\d+/)} S{fn.match(/S(\d+)/).pad(2)}E{fn.match(/E(\d+)/).pad(2)}"
This seems to execute OK.

However, the problem is that the input folder contains a mix of movies and TV shows and so I get folder structures in the output folder for both. Since I only what the TV shows, I thought of using --file-filter in the command with a conditional expression "s !== 0" on the assumption that the Season Number would not be set when Filebot parsed a movie file name. So this is how I changed the command:

Code: Select all

filebot -rename "C:\users\xxxx\xxxx\STRM SAMPLE" --file-filter "s !== 0" --action copy --db file --format "C:\Users\xxxx\xxxx\TV SHOWS /{fn.before(/S\d+/)/fn.before(/S\d+/)} S{fn.match(/S(\d+)/).pad(2)}E{fn.match(/E(\d+)/).pad(2)}"
Unfortunately this does not seem to be working. Filebot generates the following messages:

Code: Select all

"No files selected: [C:\Users\xxxx\xxxx\STRM SAMPLE]
* Consider using -r to process folders recursively
* Consider using --file-filter "true" to disable your file filter
Rename files using [Plain File]
Failed to identify or process any files".
Would anyone be able to help me understand what I am doing wrong?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to rename only TV shows in a folder containing shows and movies

Post by rednoah »

--file-filter "s != 0" conceptually can't work because s only works for Episode type objects, but you're working with File type objects in --file-filter context, so s is always undefined. You'll have to do what you're doing in your --format, i.e. using regular expressions to check the file name to include / exclude files from processing.


:arrow: You'll have to detect "Episode vs Movie" based on the file path alone. --db file specifically disables any kind of "Episode vs Movie" auto-detection and online database matching, i.e. Plain File Mode. Assuming that your episode files are nicely named already, with easy-to-match S01E01 patterns, then you can do something like this:

Code: Select all

--file-filter "fn =~ /S\d+E\d+/"
:idea: Please read the FAQ and How to Request Help.
Sydneybrit
Posts: 3
Joined: 18 Jul 2021, 06:32

Re: [Plain File Mode] How to rename only TV shows in a folder containing shows and movies

Post by Sydneybrit »

Thanks @rednoah

My episode filenames are all structured like this "#blackAF S01 E01", so the pattern should be easy to match. I tried using the expression you provided but Filebot is still saying "No files selected".

I'm wondering if this is because there is a space between the series and episode numbers? I tried modifying the expression to: --file-filter "fn =~ /S\d+' '+E\d+/" but still no files selected.

Any ideas?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Plain File Mode] How to rename only TV shows in a folder containing shows and movies

Post by rednoah »

e.g. match S01E01

Code: Select all

S\d+E\d+
e.g. match S01 E01

Code: Select all

S\d+.E\d+
. ... matches one character of anything


:idea: Use regexr to prototype your regular expressions.
:idea: Please read the FAQ and How to Request Help.
Sydneybrit
Posts: 3
Joined: 18 Jul 2021, 06:32

Re: [Plain File Mode] How to rename only TV shows in a folder containing shows and movies

Post by Sydneybrit »

Hi rednoah

I've just tried the expression "S\d+.E\d+" and it seems to have worked. Filebot is now copying just tv shows!

Thanks for your help. Much appreciated!
Post Reply