Page 1 of 1

Expression to deal with multiple episodes in a single file

Posted: 14 Mar 2021, 00:50
by Xiphan
After looking through the forum for ways to deal with multiple episodes in a single file I came up with the following expression:

Code: Select all

{episode.regular ? {' '+s.pad(2)+'x'+episodes.collect{[it.episode]*.pad(2).join('x') }.join('-')} : ' 00x'+special.pad(2)}
Which seems to do exactly what I want if there is only two episodes in the file, but something like episode one of SGU which has three parts for its first episode it breaks down and does something weird. How can I fix the expression so that I end up with something like this: 01x01-03?

Re: Expression to deal with multiple episodes in a single file

Posted: 14 Mar 2021, 20:03
by kim
replace 01x01-03
with S01E01-E03

Re: Expression to deal with multiple episodes in a single file

Posted: 17 Mar 2021, 12:43
by rednoah
Do the {s00e00} and {sxe} built-in bindings not already support MultiEpisode type metadata as expected by Plex and Kodi? Do we want something different in this particular case?

Re: Expression to deal with multiple episodes in a single file

Posted: 17 Mar 2021, 14:49
by kim
e.g.

Code: Select all

01x01-03
will fail and detect as only

Code: Select all

01x01

Re: Expression to deal with multiple episodes in a single file

Posted: 17 Mar 2021, 16:50
by rednoah
I see. The 1x01 type pattern seems to be limited to range patterns such as 01x01-02 and 01x01-02-03. 01x01-03 indeed does not work as expected. I'll look into it.