Page 1 of 1

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

Posted: 25 Apr 2022, 20:39
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(', ')]}

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

Posted: 28 Apr 2022, 03:28
by rednoah
List.take() will work.

e.g.

Code: Select all

{ textLanguages.take(5) }

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

Posted: 29 Apr 2022, 16:25
by Eye
Sorry double posting

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

Posted: 29 Apr 2022, 16:32
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?

;)

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

Posted: 29 Apr 2022, 20:10
by rednoah
e.g.

Code: Select all

{ textLanguages.size() > 5 ? '[MORE SUBS]' : null }