The library is configured to keep all episodes and never delete them, and I haven’t watched the episode or deleted the original, so going by what I understand of the optimization feature it should stay in Plex. Also, the optimized version is still on disk, so it’s more like Plex is just removing it from the database than actually deleting it.
In the most recent instance I optimized a single episode for TV, putting the files in the library root (sibling to the actual show directory). Since it’s a single episode, there’s no “unwatched only” or limit options to set, just the target optimization (mobile/tv/original/custom) and the file location.
I’m remote at the moment so I can’t pull logs for you right away. I’ll get them once I have access again. In the meantime, are there things I can check on that might make Plex delete the optimizations?
Reconnecting the “deleted” optimization with the episode would work too, though I’d like it to just not remove it in the first place.
There are some other topics similar to this one, but they all appear to be cases where the original file was deleted.
edit: I can get logs while remote. Which part of the logs will help here?
This was not the issue. Plex still says the optimized versions are deleted, even when Shoko doesn’t have access to the files.
Original:
I think I got this figured out. It wasn’t a Plex issue, but with Shoko Anime.
What was happening is that Shoko Anime was detecting the optimized version and did… something to it shortly after file creation. Shoko’s logs reported that it was skipping a rename action, but there might be some other action that happened alongside. Whatever it was, though, it broke Plex’s connection to the optimized version.
The solution is to prevent Shoko Anime from seeing the Plex Versions directory. I run Shoko in a Docker container and use the top-level Plex Versions directory exclusively, so I was able to shadow that directory with an empty anonymous docker volume. After that, I removed all lingering optimized version files and had Plex recreate one of them. On completion, the file remains. I’ll set up my other optimizations and see if this holds.
Even if it does hold, this is definitely a bandage job, and I don’t think this scales well to keeping optimized versions with the original files since there are too many directories to shadow. Nor does it work with non-Docker installations of Shoko. Those installs would probably need some clever file permissions to prevent Shoko from operating in the Plex Versions directories. A true solution will need Shoko to ignore Plex Versions directories directly, or for the scan it makes to actually be a no-op in this kind of situation.