Please tell me my superstrict handler script is not necessary
-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Please tell me my superstrict handler script is not necessary
Filebot keeps on giving me the wrong match sometimes, even without using the -non-strict switch. I have built a script years ago that cuts a clip of the video till the first keyframe, and puts it in solitary confinement in "%temp%\generated subdir" to be renamed, so that I can search and find out the new name it wants to give my video beforehand. I then match this new name in a super strict manner against the original filename's "name year" and if that matches exactly it proceeds to really rename the file. If I recall correctly, I was forced to build this script because the undo function wasn't working, but I'm not sure though. I am now rewriting my entire script cluster and this particular script has me a bit baffled, and I must make sure this isn't absolutely crazy before proceeding.
Re: Please tell me my superstrict handler script is not necessary

cafevincent wrote: ↑21 Aug 2024, 10:05 I was forced to build this script because the undo function wasn't working, but I'm not sure though.

-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Re: Please tell me my superstrict handler script is not necessary
you mean sample file paths of mismatched ones? I have not had any of those for years because I've been using this script. it only works for movies, the episode one has not been working since I last asked for your help fixing it, maybe 6 years ago.
I think the issue with revert may had been that the new filename is unknown to the script, so I can't use the feature. Or even check if the renaming was satisfactory.
I think the issue with revert may had been that the new filename is unknown to the script, so I can't use the feature. Or even check if the renaming was satisfactory.
Re: Please tell me my superstrict handler script is not necessary
Yes, mismatched file paths would be helpful. FileBot works for all use cases known to us, but there surely is an infinite number of rare corner cases were things conceivably go awry. The Name (Year) requirement is for Movie Mode. AFAIK, in Serie Mode the (Year) bit is not strictly required even in Strict Mode because (Year) is extremely uncommon in this category. {tmdb-id} markers are used disambiguate TV Shows with the same name nowadays. That said, if your files already follow a strict naming pattern of some kind, then there may be optimizations that can make FileBot work better for your specific use case.
FileBot can only revert files that have been moved / renamed with FileBot, i.e. operations recorded in the history.xml file.cafevincent wrote: ↑21 Aug 2024, 10:23 I think the issue with revert may had been that the new filename is unknown to the script, so I can't use the feature.
-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Re: Please tell me my superstrict handler script is not necessary
I think the issue may have been that filebot uses the path in matching, leading to unexpected results. If I recall. Even if I force a --q query it does not force the match. I may have to build a testing script to run though a few hundred files to figure out the current state of this.
Is it possible to get the new filename from filebot without automatically doing the renaming? So that I could force a 100% matching title + year
Is it possible to get the new filename from filebot without automatically doing the renaming? So that I could force a 100% matching title + year
Re: Please tell me my superstrict handler script is not necessary
--q will force the search query. A query like --q "Doctor Who" will give you multiple search results. A query like --q "Doctor Who (1963)" might work better, but the database may still give you a list of multiple search results. The end result depends largely on the files you have and the context. If the file is identifiable to a human based on the file path alone, then it's generally identifiable to FileBot as well.cafevincent wrote: ↑21 Aug 2024, 10:44 I think the issue may have been that filebot uses the path in matching, leading to unexpected results. If I recall. Even if I force a --q query it does not force the match. I may have to build a testing script to run though a few hundred files to figure out the current state of this.

No, but --filter could certainly be used to limit matching to specific series name / years / ids / etc. See --filter and fine-tuning for details.cafevincent wrote: ↑21 Aug 2024, 10:44 Is it possible to get the new filename from filebot without automatically doing the renaming? So that I could force a 100% matching title + year

Shell: Select all
--q "Doctor Who" --filter "y < 1970"
EDIT:

(NOTE: this approach may disable the history / revert feature because filebot does not know what your shell script does)
Re: Please tell me my superstrict handler script is not necessary
cafevincent wrote:21 Aug 2024, 19:11 here is one failed rename for movie "The Father (2020)" usingShell: Select all
--q "The Father" --filter "y < 2020"
It gets renamed to "Dragon Ball Z Bardock - The Father of Goku (1990) Mitsuo Hashimoto [Animation, Action, Drama] c13 r78 1080p x265M AAC tt0142245.mkv"Code: Select all
Rename movies using [TheMovieDB] Looking up movie by query [The Father] Apply filter [y < 2020] on [29] options Include [Dragon Ball Z: Bardock - The Father of Goku (1990)] Include [The Father (2011)] Include [The Father (2009)] Include [The Father (1969)] Include [The Father (2000)] Include [In the Name of the Father (1993)] Include [Father of the Bride Part II (1995)] Include [Father of the Bride (1950)] Include [Father of the Bride (1991)] Include [My Father the Hero (1994)] Include [My Father the Hero (1991)] Include [The Courtship of Eddie's Father (1963)] Include [The Godfather (1972)] Include [The Stepfather (2009)] Include [The Stepfather (1987)] Include [The Other (1972)] Include [The Mother (2003)] Include [Like Father (2018)] Include [The Face of Another (1966)] Include [The Black Godfather (2019)] [20] options remaining
I don't understand. there must be a way to force the query to be an exact query, so that only movies with the full title being "The Father" are accepted. And why didn't the year filter work?
https://www.themoviedb.org/movie/600354-the-father

1.
You forgot to include the file path in your PM so I made something up for testing:
Code: Select all
The Father (2020).mkv
Console Output: Select all
$ filebot -rename "The Father (2020).mkv" --db TheMovieDB --format "{plex.id}" --log INFO
[MOVE] from [The Father (2020).mkv] to [Movies/The Father (2020) {tmdb-600354}/The Father (2020).mkv]
2.
If we assume that you have a file path that is completely random and misleading and thus cannot possibly work:
Code: Select all
FileBot.mkv
Shell: Select all
--q "The Father (2020)"
Console Output: Select all
$ filebot -rename "FileBot.mkv" --q "The Father (2020)" --db TheMovieDB --format "{plex.id}" --log INFO
[MOVE] from [FileBot.mkv] to [Movies/The Father (2020) {tmdb-600354}/The Father (2020).mkv]
e.g.
Shell: Select all
--q "The Father"
Console Output: Select all
$ filebot -rename "FileBot.mkv" --q "The Father" --db TheMovieDB --format "{plex.id}" --log INFO
[MOVE] from [FileBot.mkv] to [Movies/The Father (2020) {tmdb-600354}/The Father (2020).mkv]
3.
If we further assume that --q alone somehow doesn't work for some reason. I don't have a test case for that since everything I can think of just works. But whatever the case maybe, if --q gives you a set of movies to choose from, then your --filter does the choosing with your own arbitrary custom code.
e.g.
Shell: Select all
--q "The Father" --filter "n == /The Father/ && y == 2020"
Console Output: Select all
$ filebot -rename "FileBot.mkv" --q "The Father" --filter "n == /The Father/ && y == 2020" --db TheMovieDB --format "{plex.id}"
Rename movies using [TheMovieDB]
Looking up movie by query [The Father]
Apply filter [n == /The Father/ && y == 2020] on [29] options
Include [The Father (2020)]
[1] options remaining
...
[MOVE] from [FileBot.mkv] to [Movies/The Father (2020) {tmdb-600354}/The Father (2020).mkv]
-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Re: Please tell me my superstrict handler script is not necessary
OMG I can't believe I've made this huge complex script before learning all this precision filtering! Thank you so much!
Re: Please tell me my superstrict handler script is not necessary
Cheers! Keep us posted on what you end up with. For the next guy.
Re: Please tell me my superstrict handler script is not necessary
cafevincent wrote:27 Aug 2024, 08:34 is this how I would filter for S01E01?
also, is it case sensitive or no?Shell: Select all
filebot -rename "%videoFile%" --q "%title%" --filter "n == /%title%/ && y == %year% && e == S01E01" @"%utils%\filebot-s.arg"







-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Re: Please tell me my superstrict handler script is not necessary
I can't ever match filename to database with this strict method if the title has a ':' if the database. how to work around this?
Re: Please tell me my superstrict handler script is not necessary
cafevincent wrote: ↑03 Sep 2024, 12:34 I can't ever match filename to database with this strict method if the title has a ':' if the database. how to work around this?


Groovy: Select all
n.colon(' ') == /%title%/
Groovy: Select all
"a:b".colon(' ') == "a b" // true
-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Re: Please tell me my superstrict handler script is not necessary
This is what I mean. My script can't possibly know where to put a : for a proper match for such cases. Another one:Rename movies using [TheMovieDB]
Looking up movie by query [A Quiet Place Day One]
Apply filter [n == /A Quiet Place Day One/ && y == 2024] on [4] options
Exclude [A Quiet Place: Day One (2024)]
Exclude [A Quiet Place (2018)]
Exclude [A Quiet Place Part II (2021)]
Exclude [A Quiet Place to Kill (1970)]
[0] options remaining
* Consider using --filter "true" to disable your filter if your filter has unexpectedly excluded all potential matches
Failed to find a matching movie: [A Quiet Place: Day One (2024), A Quiet Place (2018), A Quiet Place Part II (2021), A Quiet Place to Kill (1970)]
Failure (×_×)⌒☆
I wish there was a way to do a strict filtering with /.../ but ignoring any missing special characters.Rename movies using [TheMovieDB]
Looking up movie by query [Aries Spears Hollywood Look Im Smiling]
Apply filter [n == /Aries Spears Hollywood Look Im Smiling/ && y == 2011] on [1] options
Exclude [Aries Spears: Hollywood, Look I'm Smiling (2011)]
[0] options remaining
* Consider using --filter "true" to disable your filter if your filter has unexpectedly excluded all potential matches
Failed to find a matching movie: [Aries Spears: Hollywood, Look I'm Smiling (2011)]
Failure (×_×)⌒☆
Re: Please tell me my superstrict handler script is not necessary
cafevincent wrote: ↑04 Sep 2024, 11:03 This is what I mean. My script can't possibly know where to put a : for a proper match for such cases.
cafevincent wrote: ↑04 Sep 2024, 11:03 I wish there was a way to do a strict filtering with /.../ but ignoring any missing special characters.
Please read my previous reply again, bearing in mind that it already gives you the solution you are looking for:
rednoah wrote: ↑03 Sep 2024, 17:05You would naturally have to change your n == /%title%/ code to account for these kinds of variations. "a:b" and "a b" is not the same, but you could normalize n with your own custom code to better match your own custom file names:
Groovy: Select all
n.colon(' ') == /%title%/
Groovy: Select all
"a:b".colon(' ') == "a b" // true

-
- Posts: 61
- Joined: 22 Jun 2017, 10:08
Re: Please tell me my superstrict handler script is not necessary
I'm trying but I don't understand literally anything what you just said, or in the previous message. I can't even begin to form a question about it.
After further consideration you seem to be talking about removing characters from filebot suggestions before they are delivered. so n.colon('') would remove the colon? I assume n.colon(' ') would result in a double space since there usually is a space after a colon. Where do I put this? Inside the filter?
This is very exciting! I will be needing help with removing more than just the colon... anything that cannot exist in a filename must be removed, plus other troublesome characters. First thing I need is to replace " - " with " ". can you give me a reference page on this stuff? what language is this? chatgpt may be able to help if I could tell it what this is.
After further consideration you seem to be talking about removing characters from filebot suggestions before they are delivered. so n.colon('') would remove the colon? I assume n.colon(' ') would result in a double space since there usually is a space after a colon. Where do I put this? Inside the filter?
Code: Select all
--filter "n.colon('') == /!title!/
Re: Please tell me my superstrict handler script is not necessary
colon() already takes care of normalizing surrounding white space as well. You'll want to use the Format Editor to run some tests, e.g. paste "a: b".colon(' ') and see the result.
You are using Groovy:
viewtopic.php?t=10824
But this question is more of a "regular expression" question, i.e. replace certain patterns of text.
e.g. replace all non-space non-word characters:
You are using Groovy:
viewtopic.php?t=10824
But this question is more of a "regular expression" question, i.e. replace certain patterns of text.
e.g. replace all non-space non-word characters:
Groovy: Select all
n.replaceAll(/[^\s\w]/, '')
Re: Please tell me my superstrict handler script is not necessary
The Format Editor allows you to see what the code does, so that you can get instant feedback as you are developing your custom filter expressioncafevincent wrote:06 Sep 2024, 08:15 I don't understand the format editor in the GUI. I enter, for example, "a: b".colon(' ') and I get nothing at all. What is supposed to happen? How is this helpful? I know you're always trying to push me to test everything here, but I don't get it.
e.g. if you don't know what { n.colon(' ') } does then you can run the code and see what it does, and play with different values to see what the code does for different values
e.g. if you compare two values with == you'll want to verify that these two values actually are what you think they are.


EDIT:

rednoah wrote: ↑27 Oct 2014, 20:54You can prototype your custom filter expression with the filebot -list command:
Console Output: Select all
$ filebot -list --q "One Piece" --format "{today} | {n} | {sxe} | {airdate} | {age} | {age < 7}" --filter "{age < 7}" Apply filter [{age < 7}] on [1151] options Include [One Piece - 22x1118 - The Holy Land in Tumult! Sai and Leo's Full-Power Blow!] [1] option remaining 2024-09-11 | One Piece | 22x1118 | 2024-09-08 | 3 | true
You can prototype and test your custom filter expression in the FileBot Desktop application, either in the Format Editor to test with one item at a time, or in the List Editor to test with multiple items at once:
![]()