Page 2 of 2

Re: Series - Fix inputs of 1of6 to S01E01

Posted: 28 Mar 2023, 10:27
by rednoah
= is the assignment operator. This is completely wrong. Syntactically correct, but doesn't do what you think it does.

== is the equals operator. Still wrong, because you're using a regex on the right-hand side.

=~ is the regex-find operator. ==~ is the regex-match operator. Those make sense if you want to check if the first genre matches regex /Documentary|News/.



:idea: Note that {genre} is equivalent to { genres[0] } and thus always the first genre. { genre[0] } would be first letter of the first genre.



:arrow: The simple solution is this:

Code: Select all

{ genre ==~ /Documentary|News/ ? 'Documentaries' : 'TV Shows' }
** I've added this example to the list: viewtopic.php?t=4191

Re: Series - Fix inputs of 1of6 to S01E01

Posted: 29 Mar 2023, 09:19
by 2elles
Finally this seems to work and takes care of null/empty Genre entries

Code: Select all

{ genre ==~ /Documentary|News|History/ ? 'documentary/series/' : 'series/' }{ (any{genre; 'replaceme'}{'documentary/series/'}).replace(/replaceme/,'') }{ ~plex.id % {' - [$hd $vf $vc $ac $channels $hdr]'} }{ '.'+lang.ISO2}

Re: Series - Fix inputs of 1of6 to S01E01

Posted: 29 Mar 2023, 10:16
by rednoah
e.g. catch errors and default to some value:

Code: Select all

{
	any{ genre ==~ /Documentary|News/ ? 'Documentaries' : 'TV Shows' }{ 'TV Shows (No Genre)' }
}

Re: Series - Fix inputs of 1of6 to S01E01

Posted: 03 Apr 2023, 07:59
by 2elles
Perfect.
Can I add $hdr and $hd without it dropping the whole quality line?
For example:

Code: Select all

{" [$vf, $vc, $ac]"}

Result:
The Queen's Gambit - S01E01 - Openings [1080p, x265, EAC3]
But when I add $hdr or $hd it evaporates:

Code: Select all

{" [$vf, $vc, $ac, $hdr]"}

Result:
The Queen's Gambit - S01E01 - Openings

Re: Series - Fix inputs of 1of6 to S01E01

Posted: 04 Apr 2023, 11:45
by rednoah
e.g.

Code: Select all

{ allOf{ vf }{ vc }{ ac }{ hdr } }
:arrow: viewtopic.php?t=1895