Series - Fix inputs of 1of6 to S01E01

Support for Ubuntu and other Desktop Linux distributions
User avatar
rednoah
The Source
Posts: 23120
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series - Fix inputs of 1of6 to S01E01

Post 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
:idea: Please read the FAQ and How to Request Help.
2elles
Posts: 16
Joined: 25 Oct 2019, 05:24

Re: Series - Fix inputs of 1of6 to S01E01

Post 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}
User avatar
rednoah
The Source
Posts: 23120
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series - Fix inputs of 1of6 to S01E01

Post 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)' }
}
:idea: Please read the FAQ and How to Request Help.
2elles
Posts: 16
Joined: 25 Oct 2019, 05:24

Re: Series - Fix inputs of 1of6 to S01E01

Post 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
User avatar
rednoah
The Source
Posts: 23120
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Series - Fix inputs of 1of6 to S01E01

Post by rednoah »

e.g.

Code: Select all

{ allOf{ vf }{ vc }{ ac }{ hdr } }
:arrow: viewtopic.php?t=1895
:idea: Please read the FAQ and How to Request Help.
Post Reply