Page 1 of 1
Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically
Posted: 26 Nov 2022, 16:22
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" ?
Re: How to Use While Loop for a special case
Posted: 26 Nov 2022, 16:30
by rednoah

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.

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/

Please read
How to Request Help for details:
Re: www.something.com - actual file name
Posted: 26 Nov 2022, 17:36
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.
Re: while loop for special cases
Posted: 27 Nov 2022, 05:54
by rednoah
rednoah wrote: ↑26 Nov 2022, 16:30

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]

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).
Re: Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically
Posted: 27 Nov 2022, 06:08
by ariftwister
yeah... now i got some clarity. Thanks a lot.
Re: Files named [www.example.com - Bhoomi Enna Suthuthey (2022) S01EP01] are not identified correctly automatically
Posted: 29 Nov 2022, 07:29
by rednoah
FileBot r9413 will improve out-of-the-box support for this kind of use case.