Page 1 of 1
Sort movies by year range (e.g. 1900-1999)
Posted: 21 Apr 2017, 10:09
by Frederiklol
Hi,
I have been using a rather unusal folder structure for my movies.
Which is like this
/Movies/1900 - 1999
/2000 - 2010
/2011
/2012
And so forth..
So, the AMC script are actually working fine for newer movies. But Filebot creates new folders for older movies like 1995(Which make sense, as my script indicates it should do that, i am aware)
But is there any expression i could use to format that to fit my actual needs? I cant seem to figure out how to say movies from 19xx ->(go to) that exact folder.
Have a great weekend

Re: Sort movies by my broken organization
Posted: 21 Apr 2017, 12:51
by rednoah
That's a cute use case. A simple if-then-else will get job done:
Code: Select all
{y > 2010 ? y : y > 1999 ? '2000-2010' : '1900-1999'}
Re: Sort movies by year range (e.g. 1900-1999)
Posted: 26 Apr 2017, 12:43
by Frederiklol
I completely forgot about this.
You are a wizard for us "noobs".
It worked flawlessly, in first try.
Thank you once again!!
Re: Sort movies by year range (e.g. 1900-1999)
Posted: 26 Apr 2017, 14:43
by Frederiklol
While i am at it.. Im trying to cut from 2 scripts to 1..
Is it possible to make filebot try to match a collection
Like this;
Code: Select all
{any{'Movie Collections/'+collection}{'Movie'}}/{ny})
But if no match for collection is found then use
Code: Select all
{y > 2010 ? y : y > 1999 ? '2000 - 2010' : '19xx - 1999'}/{ny}/{ny}
Cant seem to figure out if that is possible. Right now i am using two scripts to seperate..
Re: Sort movies by year range (e.g. 1900-1999)
Posted: 26 Apr 2017, 15:36
by rednoah
Sure:
Code: Select all
any{"Movie Collections/$collection"}{"${y > 2010 ? y : y > 1999 ? '2000 - 2010' : '19xx - 1999'}/Movies"}
Re: Sort movies by year range (e.g. 1900-1999)
Posted: 26 Apr 2017, 20:23
by Frederiklol
Thank you for the reply.
Unfortunately i am not that great with expression, format and anything in between, BUT!
I got it to work with some modifications, this is how it looks(Used the -action test)
Code: Select all
"/volume1/Media/Test/{any{'Collections/'+collection}{y > 2010 ? y : y > 1999 ? '2000 - 2010' : '19xx - 1999'}}/{ny} {vc}-{vf} {source}{'.'+lang}"
Thank you once again!
Re: Sort movies by year range (e.g. 1900-1999)
Posted: 27 Apr 2017, 01:09
by rednoah
I was using "..." in the format, so on the command-line you'd have to escape that correctly because "..." already has special meaning.

Use the
@file syntax for reading command-line arguments from external text files so you don't have to worry about command-line argument parsing.
Re: Sort movies by year range (e.g. 1900-1999)
Posted: 10 Jun 2020, 00:12
by AbedlaPaille
Code: Select all
{
y > 2019 ? '2020'
: y > 2014
? '2015-2019'
: y > 2009
? '2010-2014'
: y > 2004
? '2005-2009'
: y > 1999
? '2000-2004'
: y > 1989
? '1990-1999'
: y > 1979
? '1980-1989'
: y > 1969
? '1970-1979'
: y > 1959
? '1960-1969'
: y > 1949
? '1950-1959'
: '1900-1949'
}
For the perfectionists

Re: Sort movies by year range (e.g. 1900-1999)
Posted: 10 Jun 2020, 00:56
by kim
why not use Switch Statement ?
https://www.tutorialspoint.com/groovy/g ... tement.htm
https://groovy-lang.org/semantics.html
e.g.
Code: Select all
{
switch (y) {
case {y > 2019}:
return '2020'
case {y > 2014}:
return '2015-2019'
case {y > 2009}:
return '2010-2014'
default:
return 'bad year'
}
}