Excluding multiple shows with excludes.txt
Code: Select all
--filter "n != /Magnum, P.I/"
Code: Select all
--filter '!(n in lines("/home/moi/excludes.txt"))'
Code: Select all
Magnum, P.I
CSI Crime Scene Investigation
Thanks
Alfke
The ultimate TV and Movie Renamer
https://www.filebot.net/forums/
Code: Select all
--filter "n != /Magnum, P.I/"
Code: Select all
--filter '!(n in lines("/home/moi/excludes.txt"))'
Code: Select all
Magnum, P.I
CSI Crime Scene Investigation
https://thetvdb.com/series/magnum-piMagnum, P.I.
https://thetvdb.com/series/csi-crime-sc ... estigationCSI: Crime Scene Investigation
Code: Select all
--filter "!readLines('%FilterPath%').join().findAll(/\d+[^(19|20)\d{2}]/)*.toInteger().contains(id)"
Code: Select all
id Name of TV Show / Movie
-------------------------------
74380 Magnum, P.I. (1980)
72546 CSI: Crime Scene Investigation (2000)
Code: Select all
none{ id.toString() in csv('/path/to/excludes.tsv') }
I couldn't get this to work (syntax errors) but Kim's solution with the table worked.rednoah wrote: ↑09 Oct 2021, 04:30 If you're using a lookup table like the one suggest above, then you can use the csv() function to read it in as a Map object:Code: Select all
none{ id.toString() in csv('/path/to/excludes.tsv') }
id in csv(...) won't work because id is an Integer value, but the Map keys are String values.
Code: Select all
filebot -script fn:amc /mnt/media/Downloads --output /mnt/media --action move --conflict auto --def clean=y -non-strict --def deleteAfterExtract=y --log-file /mnt/media/Logs/amc.log --filter '!readLines('/mnt/media/scripts/excludes.txt').contains(n)'
Code: Select all
args[18] = !readLines(/mnt/media/scripts/excludes.txt).contains(n)
Syntax Error: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script3.groovy: 1: unexpected token: media @ line 1, column 17.
!readLines(/mnt/media/scripts/excludes.txt).contains(n)
^
1 error
Code: Select all
246641
352290
248041
255199
370703
109551
267260
79508
186601
Code: Select all
--filter '!(n in lines("/mnt/media/scripts/excludes.txt"))'
Code: Select all
Fetching episode data for [La Brea]
Apply filter [!(n in lines("/mnt/media/scripts/excludes.txt"))] on [10] options
Include [La Brea - 1x01 - Pilot]
Include [La Brea - 1x02 - Day Two]
Include [La Brea - 1x03 - The Hunt]
Include [La Brea - 1x04 - The New Arrival]
Include [La Brea - 1x05 - The Way Home]
Include [La Brea - 1x06 - The Fort]
Include [La Brea - 1x07 - The Storm]
Include [La Brea - 1x08 - Origins]
Include [La Brea - 1x09 - Fathers and Sons]
Include [La Brea - 1x10 - Topanga]
[10] options remaining
Code: Select all
74380 Magnum, P.I. (1980)
72546 CSI: Crime Scene Investigation (2000)
Code: Select all
--filter "none{ id.toString() in csv('/path/to/excludes.tsv') }"
snowybunting wrote: ↑11 Oct 2021, 18:29Code: Select all
args[18] = !readLines(/mnt/media/scripts/excludes.txt).contains(n)
snowybunting wrote: ↑11 Oct 2021, 18:29Code: Select all
246641 ...
Code: Select all
n in lines("/mnt/media/scripts/excludes.txt")
OK, that makes sense. I honestly looked for a long time on explanations for lines after "--filter" and what they mean and do, but could not find anything besides old forum posts.rednoah wrote: ↑12 Oct 2021, 02:04 1. Create a file that looks like this:Code: Select all
74380 Magnum, P.I. (1980) 72546 CSI: Crime Scene Investigation (2000)
Note that we use the TAB character to separate ID ➔ NAME columns.
2.
Add this filter option to your commad:Code: Select all
--filter "none{ id.toString() in csv('/path/to/excludes.tsv') }"
Replace /path/to/excludes.tsv with the actual path. The '...' are required.
I just grabbed the error message from the log file, the '...' were truncated in that.You have removed the '...' (perhaps accidentally due to quoting the argument incorrectly) and so the format code is syntactically incorrect:
snowybunting wrote: ↑11 Oct 2021, 18:29Code: Select all
args[18] = !readLines(/mnt/media/scripts/excludes.txt).contains(n)
Again, perfect sense, but at the time I was thinking somehow your code magically turned the tvdb ID into a show name for the --filter to do its work. Lots of wishful thinking/hoping on my part.You are checking if the series name {n} (as opposed to series id {id}) is in your exclude list, which is never true, and so your format code is logically incorrect:
snowybunting wrote: ↑11 Oct 2021, 18:29Code: Select all
246641 ...
Code: Select all
n in lines("/mnt/media/scripts/excludes.txt")
Code: Select all
filebot -list --q CSI -non-strict --format "{id in [1431]} | {id} | {n} | {s00e00}" | grep S01E01
true | 1431 | CSI: Crime Scene Investigation | S01E01
false | 1620 | CSI: Miami | S01E01
false | 2458 | CSI: NY | S01E01
false | 122194 | CSI: Vegas | S01E01
false | 61811 | CSI: Cyber | S01E01
Code: Select all
filebot -list --q CSI -non-strict --filter "id in [1431]" --format "{id} | {n} | {s00e00}" | grep S01E01
1431 | CSI: Crime Scene Investigation | S01E01
Code: Select all
82618 Watchmen: Motion Comic (2009)
90001 Pitchmen (2009)
297138 WatchMojoq (2016)
Code: Select all
{
def list = lines('PathTo/tvdb_excludes.txt')*.tokenize('\t()').collect{ [ 'id': it[0]?.toInteger(), 'name': it[1], 'year': it[2]?.toInteger() ] }
!list.id.contains(id)
}
Code: Select all
{ def list = readLines('PathTo/tvdb_excludes.txt')*.tokenize('\t()').collect{ [ 'id': it[0]?.toInteger(), 'name': it[1], 'year': it[2]?.toInteger() ] }; !list.id.contains(id) }
Code: Select all
{ !readLines('PathTo/tvdb_excludes.txt')*.tokenize('\t()').collect{ [ 'id': it[0]?.toInteger(), 'name': it[1], 'year': it[2]?.toInteger() ] }.id.contains(id) }
Code: Select all
list.findAll{it.name =~ /(?i)watch/}.name
Code: Select all
[Watchmen: Motion Comic, WatchMojoq]
Code: Select all
\t
This is good stuff, very helpful. I'd not seen the --format page before, obviously that would have helped me. I've followed your tips, everything seems to be working as expected, just curious if having an "excludes" file for filebot to work from lets it work more efficiently, at least according to how I'm using it? Does using the --filter before testing has succeeded cause filebot to not work as I'm expecting, is that why you were fairly emphatic about that?rednoah wrote: ↑12 Oct 2021, 13:53 --format expressions and --filter expressions are the same thing, so all documentation related to naming applies equally to filtering, and vice versa.
1. use --format for testing --filter expressions, so we can see what your filter expression would include / exclude:2. use --filter only once you've thoroughly prototyped your filter expression:Code: Select all
filebot -list --q CSI -non-strict --format "{id in [1431]} | {id} | {n} | {s00e00}" | grep S01E01 true | 1431 | CSI: Crime Scene Investigation | S01E01 false | 1620 | CSI: Miami | S01E01 false | 2458 | CSI: NY | S01E01 false | 122194 | CSI: Vegas | S01E01 false | 61811 | CSI: Cyber | S01E01
Code: Select all
filebot -list --q CSI -non-strict --filter "id in [1431]" --format "{id} | {n} | {s00e00}" | grep S01E01 1431 | CSI: Crime Scene Investigation | S01E01
You'll want to use the Format Editor GUI for prototyping filter expressions, but here I'm using filebot -list because it's more copy & paste friendly.
Code: Select all
id in [1431]
Code: Select all
none{ id in [1431] }
Code: Select all
id in lines('/path/to/ids')
Code: Select all
none{ id in lines('/path/to/ids') }
Code: Select all
y < 1990
Code: Select all
382389 Star Trek: Strange New Worlds
Code: Select all
filebot -list --q "Star Trek: Strange New Worlds" --db TheTVDB -non-strict --filter "id.toString() in csv('/Users/john/.filebot/tvdb_includes.txt') " --format "{id} | {n} | {s00e00}"
[2022-07-08 10:03:52.923] Apply filter [id.toString() in csv('/Users/john/.filebot/tvdb_includes.txt')] on [61] options
[2022-07-08 10:03:53.079] Include [Star Trek: Strange New Worlds - 1x01 - Strange New Worlds]
[2022-07-08 10:03:53.082] Include [Star Trek: Strange New Worlds - 1x02 - Children of the Comet]
[2022-07-08 10:03:53.083] Include [Star Trek: Strange New Worlds - 1x03 - Ghosts of Illyria]
[2022-07-08 10:03:53.084] Include [Star Trek: Strange New Worlds - 1x04 - Memento Mori]
[2022-07-08 10:03:53.086] Include [Star Trek: Strange New Worlds - 1x05 - Spock Amok]
[2022-07-08 10:03:53.087] Include [Star Trek: Strange New Worlds - 1x06 - Lift Us Where Suffering Cannot Reach]
[2022-07-08 10:03:53.088] Include [Star Trek: Strange New Worlds - 1x07 - The Serene Squall]
[2022-07-08 10:03:53.089] Include [Star Trek: Strange New Worlds - 1x08 - The Elysian Kingdom]
[2022-07-08 10:03:53.090] Include [Star Trek: Strange New Worlds - 1x09 - All Those Who Wander]
[2022-07-08 10:03:53.091] Include [Star Trek: Strange New Worlds - 1x10 - A Quality of Mercy]
[2022-07-08 10:03:53.092] Include [Star Trek: Strange New Worlds - Special 2 - Inside The Series]
[2022-07-08 10:03:53.115] [11] options remaining
382389 | Star Trek: Strange New Worlds | S01E01
382389 | Star Trek: Strange New Worlds | S01E02
382389 | Star Trek: Strange New Worlds | S01E03
382389 | Star Trek: Strange New Worlds | S01E04
382389 | Star Trek: Strange New Worlds | S01E05
382389 | Star Trek: Strange New Worlds | S01E06
382389 | Star Trek: Strange New Worlds | S01E07
382389 | Star Trek: Strange New Worlds | S01E08
382389 | Star Trek: Strange New Worlds | S01E09
382389 | Star Trek: Strange New Worlds | S01E10
382389 | Star Trek: Strange New Worlds | S00E02
Code: Select all
id in csv('a.csv') || id in csv(/'b.csv'/)
Code: Select all
--filter "println id; println series; return true"
Code: Select all
any{ movie }{ n in ['Firefly'] }
Thank you.rednoah wrote: ↑12 Jul 2022, 19:25 e.g. there are many ways, but I'd do it like this:Code: Select all
any{ movie }{ n in ['Firefly'] }
The movie binding will throw an error if the object at hand is not a movie, and so all Movie type objects evaluate to true and thus all Movie type objects are included. The remainder of the code is the series episode include / exclude logic.
Code: Select all
{
/usr/local/bin/filebot -script fn:amc --output "/Volumes/PlexMedia/PlexServer_1" \
--action copy \
-non-strict \
--conflict index \
--log-file amc.log \
--def minFileSize=10000000 \
--def minLengthMS=300000 \
--def "ut_kind"="multi" \
--def "ut_title"="${1}" \
--def "ut_label"="${2}" \
--def "ut_dir"="${3}" \
--def "ut_rpath"="${4}" \
--def "ut_spath"="${5}" \
--def "ut_files"="${6}" \
--def "ut_bytes"="${7}" \
--def "ut_track"="${8}" \
--def "ut_info"="${9}" \
--def "ut_tags"="${10}" \
--def excludeList="/Users/john/.filebot/amc_excludes.txt" \
--def unsorted=y \
--def music=y \
--def skipExtract=y \
--def movieDB=TheMovieDB seriesDB=TheTVDB animeDB=AniDB musicDB=ID3 \
--def seriesFormat="/Volumes/PlexMedia/PlexServer_1/{plex.derive{' {thetvdb-'}{id}{'}'}{' - ['+allOf{tags}{vf}{vs}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}" \
--def movieFormat="/Volumes/PlexMedia/PlexServer_1/{plex.derive{' {imdb-'}{imdbid}{'}'}{' ['+allOf{tags}{audio.language}{if ('Documentary' in genres)'[doc]'}{info:video[0].displayAspectRatioString.colon('"∶"').replace('?', '')}{ws}{vf}{vs}{vc}{runtime}{crc32}.join(' ')}{']'}}{if (dc > 1) '.'+di}" \
"ut_title"="${1}" "ut_label"="${2}" "ut_dir"="${3}" \
--filter "true && id.toString() in csv('/Users/john/.filebot/tvdb_includes.txt') " \
-exec /Users/john/.filebot/scripts/fb_remove_non-eng_subs.sh {folder}
} >> /Users/john/.filebot/scripts/qBT_e-program_out.txt 2>&1