Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
ariftwister
Posts: 3
Joined: 24 Nov 2022, 15:36

Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically

Post by ariftwister »

Some of my movie files and tv shows have the website name prefixed in the file name like "www.something.com - actual file name" but other files doesn't have this problem. Due to this, they don't get results and are sent to unsorted. So i want to write while loop which checks the filename for prefix "www" and then rename it using a regex expression before doing the usual search and match from db.

So the logic would be

Code: Select all

while (check filename for prefix )
{rename the file }
usual matching using movieformat and seriesformat
So i am not sure how to do this correctly or should i use "if else" ?
Last edited by ariftwister on 26 Nov 2022, 17:37, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 21521
Joined: 16 Nov 2011, 08:59

Re: How to Use While Loop for a special case

Post by rednoah »

:idea: You could use Plain File Mode to clean up file names ahead-of-time with one filebot command, and then process files proper with another filebot command.


:arrow: Please PM me the file names you're having issues with. If you are using the amc script then please share the console output: https://pastebin.com/


:idea: Please read How to Request Help for details:
rednoah wrote: 31 Jul 2014, 16:40
  • Include Screenshots (absolutely required for new topics)
  • Include file paths as text when reporting mismatches (press F7 to copy debug information)
:idea: Please read the FAQ and How to Request Help.
ariftwister
Posts: 3
Joined: 24 Nov 2022, 15:36

Re: www.something.com - actual file name

Post by ariftwister »

Apologies for not creating the thread in proper format, i was away from my system.

But i need to rename only for specific files (based on {label} passed from torrent app), other files can skip it and run usual amc script. So what is the logic for that? If command or while command??

Also I have sent PM as you asked.
User avatar
rednoah
The Source
Posts: 21521
Joined: 16 Nov 2011, 08:59

Re: while loop for special cases

Post by rednoah »

rednoah wrote: 26 Nov 2022, 16:30 :idea: You could use Plain File Mode to clean up file names ahead-of-time with one filebot command, and then process files proper with another filebot command.
This means that you will have to write a custom shell script (in which you can then use any shell script code that you like) and then use that as your top-level entry script. In your custom shell script you can then do multiple filebot calls as needed. (NOTE: you cannot modify the amc script and you don't necessarily need any if-then-else or do-while loops in your custom shell script)


Option A: use Plain File Mode to pre-rename files:

Code: Select all

$ filebot -rename *.mkv --db file --format "{ fn.removeAll(/www.TamilBlasters.autos.-./) }" --log INFO
[MOVE] from [www.TamilBlasters.autos - Bhoomi Enna Suthuthey (2022) S01EP01.mkv] to [Bhoomi Enna Suthuthey (2022) S01EP01.mkv]

Option B: use How do I process specific files with specific command-line options? to process specific files with specific options:

Code: Select all

$ filebot -rename -r *.mkv --format "{plex.name}" --db TheMovieDB::TV --file-filter "fn =~ /Bhoomi.Enna.Suthuthey/" --q 129043 --log INFO
[MOVE] from [www.TamilBlasters.autos - Bhoomi Enna Suthuthey (2022) S01EP01.mkv] to [Kudi Yedamaithe - S01E01 - Him & Her.mkv]

:idea: You are not limited to Option A or Option B. That's just what came to mind, but the idea is to either pre-rename files, so the the amc script can process them in a second step, or process them with a dedicated filebot call to process them correctly right away (and move them out of the way so the amc script doesn't pick them up in a second step).
:idea: Please read the FAQ and How to Request Help.
ariftwister
Posts: 3
Joined: 24 Nov 2022, 15:36

Re: Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically

Post by ariftwister »

yeah... now i got some clarity. Thanks a lot.
User avatar
rednoah
The Source
Posts: 21521
Joined: 16 Nov 2011, 08:59

Re: Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically

Post by rednoah »

FileBot r9413 will improve out-of-the-box support for this kind of use case.
:idea: Please read the FAQ and How to Request Help.
Post Reply