Page 1 of 1

Can CLI sort based on movie title

Posted: 13 Feb 2015, 18:15
by jclancy103
I have a script I was trying to use. That would move renamed movie to a drive based on the first letter of the movie title. Ex: Firefox so would move it to the drive that houses movies with starting letters of d-h. So drive E is for movies with zero- C; drive F is for movies D-H; drive G for I-M.
My CLI script is:

I:\
F:\
[n =~ /^(?i) (0-9a-c)/ ? 'M:\' : n =~ /^(?i) (d-h)/ ? 'K:\' : n =~ /^(?i) (i-m)/ ? 'J:\' : n =~ /^(?i) (n-s)/ ? 'L:\' : n =~ /^(?i) (t)/ ? 'E:\' : 'D:\' }

This script creates a directory that is like 20 layers deep to the movie title.

So can the CLI use something like the script above to sort movies.

Thanks very much for answering.

Re: Can CLI sort based on movie title

Posted: 14 Feb 2015, 12:26
by skullzy
A simple if else statement "similar to the script you've posted" could possibly do just that.

something like

Code: Select all

{(n =~ /^(?i) (0-9a-c)/ ) ?  --output="E:/" : (n =~ /^(?i) (d-h)/ ) ? --output="F:/" : (n =~ /^(?i) (i-m)/) ? --output="G:/" : --output="D:/"}
although I'm not sure if that exact code will work as I've not tested it and I'm still new to the scene, but the logic is there.

--output="D:/" would be the default directory to place the file in case it doesn't match with any of the statements.

Re: Can CLI sort based on movie title

Posted: 20 Feb 2015, 00:37
by rednoah
--output is a cmdline option and does not allow code. So if you wanna set it dynamically you'll have to use shell code.

What you want can easily be done by passing in your own format. Then you can use Groovy code to define your output path.

@see viewtopic.php?f=5&t=2#p51

Re: Can CLI sort based on movie title

Posted: 04 Mar 2015, 03:46
by jclancy103
Thanks I will try to play with the Groovy Code and see where that leads me.

Thanks again.