Expression to deal with multiple episodes in a single file

Support for Windows users
Post Reply
Xiphan
Posts: 9
Joined: 21 May 2020, 20:45

Expression to deal with multiple episodes in a single file

Post 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?
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

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

Post by kim »

replace 01x01-03
with S01E01-E03
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post 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?
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

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

Post by kim »

e.g.

Code: Select all

01x01-03
will fail and detect as only

Code: Select all

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

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

Post 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.
:idea: Please read the FAQ and How to Request Help.
Post Reply