How do I pick the first 5 items from a list?

All about user-defined episode / movie / file name format expressions
Post Reply
Eye
Posts: 34
Joined: 07 Oct 2014, 21:22

How do I pick the first 5 items from a list?

Post by Eye »

Hi
I tried to fidel a kind of Catch for all But i have ne little problem with that

TV

Code: Select all

{ny.take(40)} - {s.pad(2)+'x'}{e.pad(2)} {' Special '+special.pad(3)}{ - " Part $pi"} - {t.take(40)} - [{any{group}{'hanimetv'}}] {source} [{resolution}] {video.codecID.join('-').replace('/', ' ')} {[vc, VF, af]} [{bitdepth}{' Bit'}] {([(audio.language.take(5) - [null, 'Undefined','Undefined / ja']).join(', ')])}{'; ' +[(text.language.take(5) - [null, 'Undefined']).join(', ')]}
The problem I have is that Some Files have like dozends Langauages and clash with the filesytem Lenghs.

does omeone know how to limit to like 5 Languages And go ... after those for?
.take(5) seems not to work ;)

Movies

Code: Select all

{NY} - {director}{" - (Part $pi)"} - [{any{group}{'NoGroup'}}] {source} [{resolution}] {video.codecID.join('-').replace('/', ' ')} {[vc, VF, af]} [{bitdepth}{' Bit'}] {([(audio.language - [null, 'Undefined','Undefined / ja']).join(', ')])}{'; ' +[(text.language - [null, 'Undefined']).join(', ')]}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I pick the first 5 items from a list?

Post by rednoah »

List.take() will work.

e.g.

Code: Select all

{ textLanguages.take(5) }
:idea: Please read the FAQ and How to Request Help.
Eye
Posts: 34
Joined: 07 Oct 2014, 21:22

Re: How do I pick the first 5 items from a list?

Post by Eye »

Sorry double posting
Last edited by Eye on 29 Apr 2022, 16:33, edited 1 time in total.
Eye
Posts: 34
Joined: 07 Oct 2014, 21:22

Re: How do I pick the first 5 items from a list?

Post by Eye »

So like

Code: Select all

{ny.take(40)} - {s.pad(2)+'x'}{e.pad(2)} {' Special '+special.pad(3)}{ - " Part $pi"} - {t.take(40)} - [{any{group}{'NoGroup''}}] {source} [{resolution}] {video.codecID.join('-').replace('/', ' ')} {[vc, VF, af]} [{bitdepth}{' Bit'}] {([(audio.language.take(5) - [null, 'Undefined','Undefined / ja']).join(', ')])}{'; ' +[(text.language.take(5) - [null, 'Undefined']).join(', ')]

{NY} - {director}{" - (Part $pi)"} - [{any{group}{'NoGroup'}}] {source} [{resolution}] {video.codecID.join('-').replace('/', ' ')} {[vc, VF, af]} [{bitdepth}{' Bit'}] {([(audio.language.take(5) - [null, 'Undefined','Undefined / ja']).join(', ')])}{'; ' +[(text.language.take(5) - [null, 'Undefined']).join(', ')]}
I dont realy see what i did different this time but Seems to work, thank you!

Do you see a way to ad something like ... to indicate that there is more Languages, but only i f there are 6?

;)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How do I pick the first 5 items from a list?

Post by rednoah »

e.g.

Code: Select all

{ textLanguages.size() > 5 ? '[MORE SUBS]' : null }
:idea: Please read the FAQ and How to Request Help.
Post Reply