Help with sorting to different drives

Any questions? Need some help?
Post Reply
cyberdoggy
Posts: 40
Joined: 03 Sep 2016, 21:27

Help with sorting to different drives

Post by cyberdoggy »

OK, it's probably pretty simple but I cannot get it right. What I want is if a video is x264 then I want it to move to a folder on my F:\ drive that would be F:\Movies (x264), If it is any other codec I want it to go to I:\Movies (whatever the codec is). I have been trying for a few hours but just cannot get it to work.
User avatar
rednoah
The Source
Posts: 23389
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with sorting to different drives

Post by rednoah »

e.g.

Format: Select all

{ vc == 'x264' ? 'F:/Movies (x264)' : 'I:/Movies' }/{ ~plex.id }
:arrow: Conditional Structures (if-then-else)
:idea: Please read the FAQ and How to Request Help.
cyberdoggy
Posts: 40
Joined: 03 Sep 2016, 21:27

Re: Help with sorting to different drives

Post by cyberdoggy »

Thanks rednoah My script was a little more complex so I cheated with an AI bot and got this line working quite well.

Format: Select all

{fn=~/2160p/ ? (vc in ['x264', 'AVC'] ? 'F:\\Movies 4K (x264)' : vc=='HEVC' ? 'I:\\Movies 4K (x265)' : 'I:\\Movies 4K (' + vc + ')') : (vc in ['x264', 'AVC'] ? 'F:\\Movies (x264)' : vc=='HEVC' ? 'I:\\Movies (x265)' : 'I:\\Movies (' + vc + ')')}
User avatar
rednoah
The Source
Posts: 23389
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with sorting to different drives

Post by rednoah »

Seems repetitive / hard to read / certainly does not express well the rules you mean to codify...


I'd probably do it like this, because you might want to read / understand / modify the code in the future:

Format: Select all

{ vc ==~ /x264|AVC/ ? 'F:/' : 'I:/' }
{ hd ==~ /UHD/ ? 'Movies 4K' : 'Movies' } ({ vc.replace('HEVC':'x265') })/
(1) Use F:/ or I:/ depending on the video codec
(2) Use Movies or Movies 4K depending on the video resolution
(3) Add the video codec (use x265 instead of HEVC if applicable) in parenthesis
:idea: Please read the FAQ and How to Request Help.
cyberdoggy
Posts: 40
Joined: 03 Sep 2016, 21:27

Re: Help with sorting to different drives

Post by cyberdoggy »

Thanks for the cleanup and the lesson. I appreciate your help.
Post Reply