Can CLI sort based on movie title

Any questions? Need some help?
Post Reply
jclancy103
Posts: 6
Joined: 20 Jan 2015, 06:59

Can CLI sort based on movie title

Post 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.
skullzy
Power User
Posts: 50
Joined: 07 Jan 2015, 22:19

Re: Can CLI sort based on movie title

Post 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.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can CLI sort based on movie title

Post 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
:idea: Please read the FAQ and How to Request Help.
jclancy103
Posts: 6
Joined: 20 Jan 2015, 06:59

Re: Can CLI sort based on movie title

Post by jclancy103 »

Thanks I will try to play with the Groovy Code and see where that leads me.

Thanks again.
Post Reply