Brackets filled if any fields populate

All about user-defined episode / movie / file name format expressions
Post Reply
ketterer
Posts: 5
Joined: 07 May 2018, 00:38

Brackets filled if any fields populate

Post by ketterer »

Hello,
I thought I understood this better, but it seems like i don't I want to rename files Moviename (year) [videoinfo] [audioinfo] [release}
but i want multiple pieces of data to appeear in each of the square brackets. I only want the square brackets to appear if they are populated, BUT i want each field to populate if its availeable, or show nothing,
I treid this

Code: Select all

Movies/{n} ({y})/{n} ({y}) {tags} {"[ ${vs}-${vf} ${hd} ${vc}]"} {"[${ac} ${channels}]"} {"[$group]"} {' CD'+pi}{subt}{fn.match(/-fanart/)}{fn.match(/-poster/)}
the biggest problem i have currently is that the brackets dont appear if any of the fields are not populated. Is there a way to make it still output even if some fields within the brackets dont get populated. I want it to do an or operation rather then and.
is there a way do this,
ketterer
Posts: 5
Joined: 07 May 2018, 00:38

Re: Brackets filled if any fields populate

Post by ketterer »

Just to clarify, I want the brackets to be displayed as long as any 1 of the fields in the bracket is populated, and not who brackets if all feilds are empty
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Brackets filled if any fields populate

Post by rednoah »

e.g.

Code: Select all

{allOf{ac}{channels}.joining(' ', '[', ']')}
:idea: Please read the FAQ and How to Request Help.
ketterer
Posts: 5
Joined: 07 May 2018, 00:38

Re: Brackets filled if any fields populate

Post by ketterer »

thanks Rednoah

Tonight a really great user anoxmous really helped me and he was able to write this. I think I understand the basic syntax, and will hopefully be able to learn from it

Code: Select all

/mnt/Multimedia/Movies/{kodi.derive{' '+tags}{' ['+allOf{any{vs+'-'+vf}{vf}}{vc.replace('AVC':'x264','HEVC':'x265')+']'}{'['+ac+' '+{channels}+{'] ['+group}}.join(' ')+']'}.tail}
Post Reply