Plex plays wrong episode (special instead of episode)

Server Version#: 1.25.1.5286
Player Version#: Recent Plex Web / Recent ATV4K App / Recent iOS App

Hi there!

This bug was fixed a while ago but now it’s back again.

Let’s say I have specials and episodes for series. Now there is a special has the same air date as the episode in their metadata.

When I click play on for example season 1 episode 1 of the series it plays episode 1 from the specials.

When I remove the air date from the specials it’s playing the selected episode. It’s kinda the same Problem as here, just the other way round now:

Is this already known? I don’t know when this was starting to happen again…

Thank you for your help :blush:

Yeah, this should have been fixed. Can you provide exact details on the show/episodes you are seeing this on? Also, if you can provide the logs from the server after recreating the playback of the wrong episode.

Maybe it’s some edge case here, as this is Anime and those are always special :grinning_face_with_smiling_eyes:

I am using another scanner and metadata plugin, which might already make this unsupported… (But as this was working before and files are still named the same way + same plugin, i thought I should ask here.)

The plugin handles matching the typical anime filenames (which can be seen in the log below) to seasons and episode numbers. (Shoko Series Scanner + Shoko Metadata)

Show: “Honzuki no Gekokujou: Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen”
Season 1 Episode 1 plays Season 0 Episode 1 (with the same air date)

Logs taken from plex web - cleaned right before clicking play. I (hopefully) removed all potentially personal data.

plexlog.log (126.6 KB)

Please provide me the actual log file. I like to see the header info with the PMS version. Looks like you also missed some info at the top I would have liked to see.

There is a fix in the recent 1.25.2 beta that just came out recently that may fix your issue. It was meant for DVR’d content having the same aired date, but should help regular content too.

I updated to 1.25.2.5319 and this seems to have done the trick for the specials, thank you :relaxed:

(Sorry for not sending the correct LOGs right away, I should have known you mean the Server’s log file from the PMS Library folder. :woozy_face:)

On investigating further, I think there is another issue which comes from the way the Metadata Plugin handles stuff.

Openings/Endings are put into Season -1, Trailer/Promos are put into Season -2, Specials into Season 0.

Season -1 shows “unknown season” and the other “Season -2” or “Season 0”.
Whenever an “unknown season” was present, it played the episode 1 from it instead of season 1 episode 1.

I fixed this, by altering the scanner and metadata plugin to put them into seasons 200/300.

If you want logs with the previous behavior, I will gladly provide them. I will then set up a new PMS instance, add the scanner/plugin, create a new library with the files and reproduce the issue. So you can see everything from adding to playback.

That depends on how you are naming the files. season/episode numbers must be correct. You can’t force something into a season just by having it in that season folder. You’ll need to provide the filenames for me to see what’s going on.

The Metadata and Scanner handles this. The filenames are as follows:

[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 01 (1920x1080 HEVC 10bit) [51EEF849].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 02 (1920x1080 HEVC 10bit) [EB5FB2A7].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 03 (1920x1080 HEVC 10bit) [29111017].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 04 (1920x1080 HEVC 10bit) [D1A47DB0].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 05 (1920x1080 HEVC 10bit) [07878B75].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 06 (1920x1080 HEVC 10bit) [C47835DF].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 07 (1920x1080 HEVC 10bit) [B0BC7FD2].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 08 (1920x1080 HEVC 10bit) [C03B0FB4].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 09 (1920x1080 HEVC 10bit) [4CCAD0E9].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 10 (1920x1080 HEVC 10bit) [DFB56508].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 11 (1920x1080 HEVC 10bit) [BD9B94E7].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 12 (1920x1080 HEVC 10bit) [1BC4EE1A].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 13 (1920x1080 HEVC 10bit) [247D05B5].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - 14 (1920x1080 HEVC 10bit) [652E52CF].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - C01 (1920x1080 Blu-ray HEVC 10bit) [481F1507].mkv
[Judas] Honzuki no Gekokujou_ Shisho ni Naru Tame ni wa Shudan o Erande Iraremasen - C02 (1920x1080 Blu-ray HEVC 10bit) [2B5ADF87].mkv

where the scanner / metadata plugin does this while getting info from its server part. Here are a few snippes from the plugins - they are also on Github (ShokoMetadata.bundle)

scanner:

                seasonNumber = 0
                seasonStr = try_get(episode_data, 'season', None)
                if episode_data['eptype'] == 'Credits': seasonNumber = -1 #season -1 for OP/ED
                elif episode_data['eptype'] == 'Trailer': seasonNumber = -2 #season -2 for Trailer
                elif Prefs['SingleSeasonOrdering'] or seasonStr == None:
                    if episode_data['eptype'] == 'Episode': seasonNumber = 1
                    elif episode_data['eptype'] == 'Special': seasonNumber = 0
                else:
                    seasonNumber = int(seasonStr.split('x')[0])
                    if seasonNumber <= 0 and episode_data['eptype'] == 'Episode': seasonNumber = 1
                    elif seasonNumber > 0 and episode_data['eptype'] == 'Special': seasonNumber = 0

metadata plugin:

                if ep['eptype'] == "Episode": season = 1
                elif ep['eptype'] == "Special": season = 0
                elif ep['eptype'] == "Credits": season = -1
                elif ep['eptype'] == "Trailer": season = -2
                if not Prefs['SingleSeasonOrdering']:
                    try:
                        season = int(ep['season'].split('x')[0])
                        if season <= 0 and ep['eptype'] == 'Episode': season = 1
                        elif season > 0 and ep['eptype'] == 'Special': season = 0
                    except:
                        pass

This part of the script matches Credits (Episodes with C before the number) to Season-1.
I changed this to Season200 and the credits are not played when playing an episode.

As I said, this might be an edge case, as it doesn’t follow the regular naming schema S0XE0X and if it’s not supported then it’s alright :slight_smile:

Oh, I didn’t realize you were using a custom scanner and agent.

Huh? Why would these play after an episode?

No problem :slight_smile:

The episodes itself have Opening/Episode/Ending all in the same file.
Those C01,C02 are separate credits, in this case without the text, just the opening/ending song. That’s the sole reason why those files are present in separate seasons.

When the credits were in “Season -1”, they played when I started playing an episode if the release date (first available) was the same as the episode - instead of the acutal episode.
removing the date fixed it. This is still the same even after the update to the newest 1.25 beta.

After moving the files with the credits to Season200, the episodes play normally (and so do the separate credit files) and don’t start playing the wrong file anymore.

I wonder why this happens… maybe it doesn’t know where the episode belongs to (Season-1 is displayed as “unknown season” in Plex Web) and plays it because of the date.
Or Season-1 is recognized as Season01 because the “-” is ignored?

Sorry if my explanations are kinda confusing…

I’m not familiar with how that agent works but to be clear it’s using season -1 and -2, not season-1 and season-2. Plex is not expecting negative seasons so this can contribute to the issue. Definitely edge case and outside of how Plex operates.

1 Like

I thought so; this explains how putting it in a high-number season (which hopefully will not be used, lol) instead of a negative season fixes the issue.
I will give this information to the developer so this can be altered.

The Season0/Season1 problem was fixed with the latest beta and I’ll mark it as solution :+1:

thank you for your patience with this :slight_smile:

ShokoMetadata (and Shoko) dev here, if you need full code you can see it here.

The reason for using the negative seasons was mostly a workaround until something like named seasons became available to the scanner/agent pipeline (which as far as I can tell, is not available due to little-to-no documentation)

Because, anime has the concept of different kinds of specials (NCED/NCOP/Parody/Extra Episodes) They are typically numbered individually, hence splitting them in different seasons was the cleanest solution I could think of, this had been a working solution within Plex 4 years ago (and was working for at least 3 years after this)

Another idea on how it could be resolved is allowing specification of “non numeric episode identifiers” outside of the episode number, being something like S1/S2/C1/C2/T1/O1 (prefixes are based off Content:Episodes - AniDB ) Though such information would be best pushed back to the web-hooks too.

Not a dev, so the code doesn’t mean much to me. :grinning_face_with_smiling_eyes:

The reason for using the negative seasons was mostly a workaround until something like named seasons

Not sure what you mean by named seasons. Seasons are numbers, you can’t use a name. You can add a season title, but there still needs to be a number. Any number is find as long as it’s > 0.

this had been a working solution within Plex 4 years ago

Yeah. Some code clean-up may have changed how negative seasons are handled.

non numeric episode identifiers

How would you order these? Episodes have a set order. These would just be random. Plex’s new TV agent does support TV Show extras. That might be a better way to include these non-episode files. I don’t know if that’s available to 3rd party agents.

Which would be the nature of a bug report, because even if it’s not a specifically intended “Feature” given the fact the server still accepts it via scanner code without any sort of errors, would indicate a malfunction, or mismatch between some validation logic that should be in place.

Simply put, specify sort order, like how series/movies have a “Sort Name” feature

[Implemented] Custom Names for Seasons (Anime Season naming) and

Actually, that is kind of the job of the agent. SQLite doesn’t actually enforce what data is put into a field. i.e. You can put text into a field set as integer. :man_shrugging: Don’t know why they allow this.

Simply put, specify sort order, like how series/movies have a “Sort Name” feature

Sure that would work. Is there a need to have things before Season 0/Specials? Couldn’t you just put them after into season 100+ like the OP did?

Mostly because it

  1. makes no sense, as they are specials, just numbered in parallel
  2. has an inherent long-term expandability problems, which I am not a fan of doing.
  3. Without any documentation (or examples) on how to set the season name at a scanner/agent level, it is confusing to an end user (though this issue exists in the negative season method too)
  4. Autoplay, some users might not want to immediately autoplay into an NCOP/NCED when ending a season.
  5. “On Deck” functionality in plex suggesting that “Season 100 - Episode 1” is next, when that’s really a special? That is counter-intuitive and would annoy me as a user.

Actually, in the SQLite (and SQL) spec, you can actually specify database constraints (CHECK constraint), but, then again, an agent is not directly interacting with SQLite, that doesn’t stop the API level validating even before attempting to put any database interaction in place (it’s a good practice for any API design, the concept of “don’t trust user input” comes to mind: Never Trust User Input | Writing Secure Code, Second Edition)

Right, the issue is you want to separate out the different types of “specials”, which is not something expected.

Without any documentation (or examples) on how to set the season name at a scanner/agent level

It’s the same as setting anything for the episode, just use the season id instead.

title.value=the_name_you_want

Make sure it’s html escaped if needed.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.