Handling exclude.txt file has changed

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
ttwaro
Posts: 9
Joined: 25 Feb 2020, 09:57

Handling exclude.txt file has changed

Post by ttwaro »

I use to be able to run this command against my exclude.txt file that contains comments (a # in column 1) and the output would be as expected.

Code: Select all

filebot -list --db TheTVDB --q "the big bang theory" -non-strict --filter '!lines("/mnt/freenas/plex/nonplex/Download/Pre-staged/exclude.txt").contains(n)'
But since a recent update to filebot it no longer works as expected. Instead filebot ignores the comment and excludes the show that I want. The purpose of me commenting the line is to self-document that the group belongs to, for example, "The Big Bang Theory". If I delete the line and run the command again then it works but I loose my self-documentation.

This is my exclude.txt file:

Code: Select all

# The Big Bang Theory
The Big 4
The Big C
The Big Easy
The Big O

# The Blacklist
The Mist
The Beast (2001)
The Beast
The Blacklist: Redemption
Black Box
The Heist
etc......
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Handling exclude.txt file has changed

Post by rednoah »

:?: You'll want to open the Format Editor GUI and run tests. What List<String> does lines() give you? Does FileBot magically exclude lines?


:idea: # has no special meaning, and never had any special meaning as far as lines() is concerned, as far as I know. lines() simply reads all the lines from a text file into a List<String> no more no less.


e.g. "The Big Bang Theory" != "# The Big Bang Theory" (NOTE: "# " makes things not the same; as would any other character)

Code: Select all

$ filebot -list --db TheTVDB --q "the big bang theory" -non-strict --filter '!["# The Big Bang Theory"].contains(n)'
Apply filter [!["# The Big Bang Theory"].contains(n)] on [358] options
Include [The Big Bang Theory - 1x01 - Pilot]
...

e.g. "The Big Bang Theory" == "The Big Bang Theory"

Code: Select all

$ filebot -list --db TheTVDB --q "the big bang theory" -non-strict --filter '!["The Big Bang Theory"].contains(n)'
Apply filter [!["The Big Bang Theory"].contains(n)] on [358] options
Include [The Big C - 1x01 - Pilot]
...

:arrow: If something doesn't work as expected, then my first guess would be invisible characters such as space or tab at the end of the line, that make things different:

Code: Select all

$ filebot -list --db TheTVDB --q "the big bang theory" -non-strict --filter '!["The Big Bang Theory "].contains(n)'
Apply filter [!["The Big Bang Theory "].contains(n)] on [358] options
Include [The Big Bang Theory - 1x01 - Pilot]
...
:idea: Please read the FAQ and How to Request Help.
ttwaro
Posts: 9
Joined: 25 Feb 2020, 09:57

Re: Handling exclude.txt file has changed

Post by ttwaro »

Thanks for the suggestions. I did finally get it to work by cheating. I replaced the '#' with '#Include-->'. This lets me self-document plus since the complete line is not a valid show name I get the results that I am after.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Handling exclude.txt file has changed

Post by rednoah »

Well, anything will work, as any of these lines are not "The Big Bang Theory"

Code: Select all

# The Big Bang Theory
#Include-->The Big Bang Theory
+++ The Big Bang Theory
xThe Big Bang Theory
INCLUDE The Big Bang Theory
...
So changing '#' to '#Include-->' notably does not make a difference, and if it appears to make a difference, then something else is going on.



EDIT:

Correction. FileBot does indeed do some magic when it comes to "x in lines()" type code. Notably, FileBot does not do a linear list search there, but instead caches an internal case-insensitive and punctuation-insensitive and space-insensitive lookup table.

e.g. if excludes.txt looks like this:

Code: Select all

# TEST
then the following code will still yield true:

Code: Select all

{ ' test !!!' in lines('excludes.txt') }
as all non-Letter / non-Digit character are effectively ignored for List::contains lookup purposes. So '#Include--> will indeed work for your purpose, because although # and --> is ignored, the extra letters in Ignore make the lookup yield false.


:idea: A traditional linear list search with exact character-by-character comparison can still be performed like so:

Code: Select all

{ lines('excludes.txt').find{ n == it } }
:idea: Please read the FAQ and How to Request Help.
ttwaro
Posts: 9
Joined: 25 Feb 2020, 09:57

Re: Handling exclude.txt file has changed

Post by ttwaro »

Thank you for the in-depth explanation. Your explanation is exactly what I am seeing though I don't know what changed since it use to work the old way for several years. But I recently renewed my filebot subscription and installed filebot 4.9.6 and that is when it stopped working. Previously I was on 4.9.5. I am happy that I found a work around. I guess it could also be from an update of my Linux machine though that gets update often.
Post Reply