Page 1 of 1
Combining filters on command line?
Posted: 20 Mar 2016, 17:11
by FadedSun
I'm using the command line, not a script. I've been looking into filters to improve the command line renaming. Right now with my limited skills I'm getting about 90% correct rate.
How do you go about combining different filters? Do you somehow combine them into one filter, or can you have two (or more)
--filter lines on the command line?
Particularly right now I'm interested in combining these two filters I found in the examples:
Code: Select all
--filter "age < 7 || !model.any{ it.age < 7 }"
Code: Select all
--filter "!readLines('''/path/to/excludes.txt''').contains(n)"
Thanks
Re: Combining filters on command line?
Posted: 20 Mar 2016, 19:14
by rednoah
1.
You can only pass one
--filter option, but you can pass more complex conditions of course.
e.g.
Code: Select all
--filter "(age < 7 || !model.any{ it.age < 7 }) && !readLines('''/path/to/excludes.txt''').contains(n)"
@see
http://docs.groovy-lang.org/next/html/d ... _operators
2.
90% correct rate
That's seems way too low, especially with a filter. What are you doing. Logs? If your filter rules don't match your use case then auto-detection can't work.
Re: Combining filters on command line?
Posted: 20 Mar 2016, 21:01
by FadedSun
I'm not sure how accurate my 90% figure is
I'm using Filebot to help rename MyhtTV recordings for Plex. Some of the shows are years old, so I couldn't be terribly picky on the filter. I was using:
Code: Select all
filebot -rename "$PRETTYFILEPATH" --db thetvdb -non-strict --filter "y > 2010" --format "/media/NAS/PlexRecordings/{n}/Season {s}/{n} - S{s.pad(2)}E{e.pad(2)} - {t}"
Now that I've converted all my previous recordings, I can afford to be a little more specific on the filter since recordings will be converted just after they air.
MythTV doesn't always have the season and episode information, so sometimes I'm left with just series and title to go on. "y > 2010" fixed a lot of my early problems but off the top of my head there's still 2 shows that aren't working right.
The Big Bang Theory. I ran it on the 2 latest episodes. One filebot named fine, the other ended up as "Eureka! The Big Bang Query - S01E01 - Episode 1.mkv"
The Walking Dead Season 6. Every episode was named wrong, episodes seemingly randomly split between being named "Fear the walking dead" and "The talking dead". Oddly enough, when I ran the same episodes through the filebot gui it named all of them correctly without even prompting me for the correct series.
Sorry I don't know how to check logs (or even if they're being created)
Re: Combining filters on command line?
Posted: 20 Mar 2016, 21:29
by rednoah
1.
I see. Walking Dead / Talking Dead is the kinda stuff where the age filter shines, but only if things are processed within a few days of the original airdate of a given episode.
Assuming that you only have popular shows, you could filter by vote count:
The shit shows usually don't have many ratings.
2.
S{s.pad(2)}E{e.pad(2)} won't work for specials and multi-episodes. I recommend using
{s00e00} instead.
3.
If the GUI has multiple options, it might ask you, it might make a decision for you (since you can always force you own query if it doesn't work out). But the CLI will choose everything and assume that the episode data from one series will be a better fit than those of another.
Re: Combining filters on command line?
Posted: 22 Mar 2016, 01:22
by FadedSun
Thanks for the tip on
s00e00, I've added that.
I also wanted to note in case anyone else is looking at this thread, you can't use
! (exclamation point) in the command line by default. It's a special character for history expansion in bash. There are several ways to fix that. I had trouble escaping the character correctly so I went with the easy way.
set +H will turn off history expansion and then
! works as normal on the command line.
I do have one more question. is it possible to impose order of operations on || and &&? I took your suggestion on adding ratings to the filter. It works great, but it turns out I do have just a few shows that must be less than popular and don't have many ratings.
I tried this:
Code: Select all
--filter "(info.ratingCount > 20 || readlines('''/media/NAS/Backup/plexincludes.txt''').contains(n) ) && !readLines('''/media/NAS/Backup/plexexcludes.txt''').contains(n)"
My intention is for it to check if the rating was over 20 or it was in my include file first then make sure it wasn't in the exclude file. This way the rating would filter a lot of the junk out, but I could fine tune for shows it's missing with the exclude or include files. But the parenthesis don't seem to be implying order of operation like I hoped, at least not on my test file. Any ideas?
Edit: Never mind, I figured it out. I had a type
readlines should be
readLines. This worked fine:
Code: Select all
--filter "(info.ratingCount > 20 || readLines('''/media/NAS/Backup/plexincludes.txt''').contains(n)) && !readLines('''/media/NAS/Backup/plexexcludes.txt''').contains(n)"
Re: Combining filters on command line?
Posted: 22 Mar 2016, 07:03
by rednoah
Use
'...' to avoid bash
! shell expansion:
More importantly, you want to specify complex arguments via text files:
viewtopic.php?f=3&t=3244
e.g.
Code: Select all
filebot -script ... --filter @/path/to/filter.txt