Umpteenth time Plex redid my library

Not sure, but was there a major update yesterday?

I had been researching as to why my movie posters kept changing. I had recently checked off that upgrade libraries pop-up. I had a feeling that would screw me and it did. All movie posters changed, new collections created, old ones made obsolete. I took a deep breath and restarted. I also realized there was one setting in scheduled tasks, Refresh library metadata periodically, that probably caused the other 2 or 10 times this happened, so I disabled it.

Was then looking for a way to download all the chosen posters locallly… still figuring that out. Lambda seems to be dead, and I’m open to suggestion on this one.

Then I realized that with the recent poster change, so had all my library sort titles disappeared as well. Despite having “locked” them a long time ago. So I figure I’d re-do them all. Went through all 1700 movies, adding and locking each sort title in. Probably only 100 or so. Last night I log on, and the whole library is gone. Empty shell collections showing, but no movies inside. Plex showing me 220 collections, but no movies. Restarted plex, still gone. Rebooted the server, and restarted plex, still gone. I check the connection to my Synology NAS (where the files are), all good. Files visible and mapped nicely in Windows 10 on my intel NUC Plex server, but simply gone from that one library. Here is the kicker, my other libraries were fine. Just the one library I spent 3 hours on updating sort files, the night before, got wiped clean. I hit scan library files, and the whole thing restarts, with thumbnail generation and everything.

Anyone have any ideas as to WTH happened?

If you use this constellation, you must never have this checkbox ticked:
“Empty trash automatically after every scan”
Otherwise, what you are describing above may happen again.

See if you can restore one of the older database backups: https://support.plex.tv/articles/202485658-restore-a-database-backed-up-via-scheduled-tasks/

So what exactly is considered trash by Plex?

Items where the media file hasn’t been found are marked as “unavailable”, which is symbolized by a trash can icon.

Frequently, users get burned by this if they let their media hard drives spin down when idle.
The first access by Plex server may then get served too late, because the file server has to spin up the hard drive first before it can serve any data. Which may complete too late and the item will get marked as trash in Plex.

https://support.plex.tv/articles/200289326-emptying-library-trash/

2 Likes

Thank you for all the explanations.
I see in the article there is a warning:
Warning! : Enabling this option means that content will be removed from your Library immediately with no chance to simply restore it if there was a mistake.

I feel like that warning should be right next to the option itself in Library settings. Most Plex users are fanatical about maintaining their libraries, and like myself, think this option is an automated spring cleaning, without fully understanding what may or may not happen. If I saw that warning, I would have deselected the option for sure.

Also, the backup worked. Missed it by a day on the backup and me finishing the sort names, but I’m 80% restored. So, thank you very much.

Finally, any idea about a still functional way to backup chosen Plex art locally?

Is this really the case? I thought Plex is smart enough to recognize the situation where the folder linked to the library itself is missing/not mounted and not move all items belonging to this path to trash. (Never ran into this problem myself, fortunately)

The case I’m describing above is different. Here, the folder is not completely missing. It just is too slow to return requested data. The second request by Plex may get a timely answer already.
Which is the explanation why sometimes only some files are trashed.

If there were special rules for marking items as trash then it would be more complex and other people with different use cases would get burned instead. I think that in this case the simplest rule that we have is best … If the item isn’t there, it is marked as trash. But that also means the automatic emptying of trash should be turned off, too. Getting burned that way is probably a top 3 complaint on this forum.

@SWETTPLEX09

Plex will update/change posters when they are updated at the online databases or when there are many selections to choose from (and there usually is).

Add your own posters to Plex, that way Plex cannot delete them or change them.

Simply name your Movie poster file the same as your Movie file, except for the file extension.

E.G.
Altered States (1980).mp4
Altered States (1980).jpg

Place the poster file alongside your Movie file in your library folder/s.

In your Movie library settings > Advanced, make sure you enable: Use Local Assets

Also check Plex Settings > Agents > Movies and make sure you have the Local Media Assets (Movies) agent enabled and sorted to the top of the list.

That way, Plex will pick up and use your poster files automatically when you add a new Movie.

You may need to Refresh Metadata for each existing file/library in order for Plex to start using your posters.

The poster images should have a resolution of 400 pixels by 600 pixels minimum. This may seem daunting at first, but if you add 20 or so per night, it wont take that long to populate all of your Movies.

I have ~8000 Movies and every one of them has it’s own poster. :wink:

Using desktop HDD’s in your NAS can cause this issue, but I have not seen it when NAS rated drives are used. If you are using desktop drives, consider replacing them with NAS rated drives.

1 Like

Yeah, I try to force Plex to do as much as possible and having my own posters and backgrounds is one of those. I would recommend using folder.ext or poster.ext instead of naming like the movie. That’s officially how Plex has it listed in their documentation. And it makes it easy to run a File Explorer search to find folders that don’t contain folder.ext to quickly see where you are missing some.

Find all folders in directory that do not have folder.jpg or folder.png
for /D /R “S:\Movies\4K UHD” %i in (*) do @(IF not exist “%i\folder.??g” echo %i)

Just one thing to add is that Plex uses a 2:3 ratio rule for the size. So in Trumpy81’s example of 400x600, it will be fine, but if you have like 450x600 like some poster databases use (3:4 ratio), then part of the sides will be cut off. But you can easily find some good posters on TMDB, TPDB, and Fanart.tv (they use 3:4).

See this page for more detail on what is and is not accepted.

https://support.plex.tv/articles/200220677-local-media-assets-movies/

Of course, you are assuming that everyone uses separate folders for every Movie, as is recommended.

I do not, I place all Movie files in Decade/Year folders and I don’t store any extras in those folders at all, only Movies and posters. Why gum up the works when you don’t need to … lol

As shown below:

Placing everything or multiple files in one folder works fine but its awful from a performance standpoint once that flat folder starts to scale.

This is because when plex detects a change in a folder its scans everything for changes in that folder. So, if you have 1000 movies/files in one flat folder and you add 1 to it then plex scans everything in that folder for changes, all 1001 rather than just the 1 which was added/changed. This is why they recommend folders for each movie.

Just something to consider in case you were not aware.

For movies I use TinyMediaManager

It renames the movie with the imdb or tmdb id number

Puts it in a folder and automatically downloads a poster named “poster” so Plex uses it

This is an older version but it’s free and still has some of the more advanced features than the current free version

TV show format
Show Name: ${showTitle} (${showYear}) {tvdb-${showTvdb}}
Season: Season ${seasonNr2}
Episode Name: ${showTitle} (${showYear}) s${seasonNr2}e${episodeNr2} ${episode.title}


Movie format
Folder format: ${title} (${year})
File format ${title} (${year}) {imdb-${imdb}}


On the topic of posters, in general for anyone interested… I also found this site

I was recently looking to distinguish my 4k movies from lower resolution copies in my library

You can customize the banner at the top in a variety of ways


If you notice, you can also shift the image down so the banner doesn’t cover important parts of the picture or text

You don’t need to use the banner btw. They also seem to have a lot more posters marked with things like Extended version or Director cut ect…

@anon5074910

You raised an interesting question in regards to performance, so I did a small test to put your theory to the test.

I created 2 test libraries and populated both libraries with 78 files (Movie + Poster = 39 Movies)

Library 01 - Folder = Movies 01 - containing 78 files in total - 14 folders
Library 02 - Folder = Movies 02 - containing 78 files in total - 39 folders

Library 01 contained the 1900-29 decade folder and inside that folder resides the following Year folders: 1902, 1903, 1915, 1918, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929.

Library 02 contained a folder for each Movie and each folder contained the Movie file and the Poster file.

I then setup a test server expressly for the purpose of this test.

I added both of the above libraries to the server.

I allowed Plex to scan in both libraries and then I disabled Preview and Chapter Thumbnails as well as Intro and Credits Markers.

After both libraries had scanned in and all metadata etc. added, I then proceeded to delete the same two file/s from each library (Movie + Poster). There was no discernible time difference between the two libraries that I could detect.

I then re-added the same files back to both libraries. Again, there was no discernible time difference between each library that I could detect.

I then added another two files, not previously in those libraries and again, no discernible time difference from the start of the library scan until the completion of metadata gathering between the two libraries.

As far as I can tell, Plex scans all folders and files regardless of their topology.

It then marks each folder/file as changed or not changed and it skips all folders/files that are not changed and it does it very quickly!!

So, my conclusion, which is tentative at best, is that there is no significant time or performance difference between the two storage layouts.

I have attached the logs from the test server. You may browse through them to see if you can determine any real differences in time/performance. Let me know what you find.

Plex Media Server Logs_2023-11-06_18-09-59.zip (270.1 KB)

I think to see a humanly recognizable difference, you’ll have to use at least hundreds of movies for the test.

1 Like

@OttoKerner

I do agree, this test was not conclusive, but I think it demonstrates that there is no real performance differences, or if there are, they would be more than acceptable IMHO.

I must admit, I was a little surprised to see Plex read each of the files regardless of the folder layout.

I had planned on changing my folder layout if I saw any real differences.

I can repeat the process with more files at a later date, but for now I am satisfied that the gain in performance would be minimal.

Otto is correct. As I said above …

… it will work fine but is awful at scale. Years ago I had all movies in 1 top level folder, think it was around 2k at that point and was taking minutes to scan when I added anything. Switched to folders per movie and its was down to seconds, under 10 I think back then.

Just ran a test and added 1 new movie, total now 4063 and scanning and adding of this movie took a total of 15 seconds …

Nov 06, 2023 09:42:51.565 [139664482691896] DEBUG - Activity: registered new activity b7b00f5c-0e0c-4f02-810d-5f66f5a5c109 - "Scanning"
...
Nov 06, 2023 09:43:06.312 [139664482691896] DEBUG - Activity: updated activity b7b00f5c-0e0c-4f02-810d-5f66f5a5c109 - completed 100.0% - Scanning Movies

OK, so I repeated the test, this time with 1492 files (746 Movies) 612GB total size.

I stopped the server and cleared the logs between each step, except when adding the single Movie to each library, I forgot to clear the logs after adding to the Movies library and shutting down the server, so adding the file to both libraries is in the final Logs - After Adding A File.zip file.

Add a Movie to Movies library results can be found in Plex Media Server.1.log file and add a Movie to Movies II library results can be found in Plex Media Server.log

The Movies library consists of the following folders/files:

The Movies II library consists of 746 Movie folders, each containing the Movie file and a Poster file.

The results are as follows:

Add Movies Library ------------------------------------------------------------

Nov 07, 2023 00:24:05.745 [4612] DEBUG - Activity: registered new activity 7781d7d1-0910-432c-af96-0474ec79891e - "Scanning"
...
Nov 07, 2023 00:29:06.747 [4612] DEBUG - Activity: updated activity 7781d7d1-0910-432c-af96-0474ec79891e - completed 100.0% - Scanning Movies

Add Movies II Library ---------------------------------------------------------

Nov 07, 2023 00:40:38.926 [13132] DEBUG - Activity: registered new activity 47ce71e7-0cd1-403c-aedf-4621e1367615 - "Scanning"
...
Nov 07, 2023 00:45:00.565 [13132] DEBUG - Activity: updated activity 47ce71e7-0cd1-403c-aedf-4621e1367615 - completed 100.0% - Scanning Movies II

Add Movie File ----------------------------------------------------------------

Movies\1950-59\1950\All About Eve (1950).mp4
Movies\1950-59\1950\All About Eve (1950).jpg

Scan Movies Library -----------------------------------------------------------

Nov 07, 2023 01:00:19.281 [5000] DEBUG - Activity: registered new activity d3f792ff-7f57-4754-ad8a-f4db512d4d63 - "Scanning"
...
Nov 07, 2023 01:00:20.112 [5000] DEBUG - Activity: updated activity d3f792ff-7f57-4754-ad8a-f4db512d4d63 - completed 100.0% - Scanning Movies

Add Movie File ----------------------------------------------------------------

Movies II\All About Eve (1950)\All About Eve (1950).mp4
Movies II\All About Eve (1950)\All About Eve (1950).jpg

Scan Movies II Library --------------------------------------------------------

Nov 07, 2023 01:04:19.220 [4436] DEBUG - Activity: registered new activity 8c5a045c-dc30-46fc-b53b-3924d019cb12 - "Scanning"
...
Nov 07, 2023 01:04:20.270 [4436] DEBUG - Activity: updated activity 8c5a045c-dc30-46fc-b53b-3924d019cb12 - completed 100.0% - Scanning Movies II

I will let you do the maths, but as far as performance is concerned, there is NOT a lot in it.

The recommended storage method does have a slight advantage over my storage method, but it is inconsequential IMHO.

I would also say that navigating my files in Windows File Explorer is less convenient using the recommended storage method compared to my storage method, but I may be biased here.

Logs - Add Library 01 complete.zip (1.0 MB)
Logs - Add Library 02 complete.zip (707.2 KB)
Logs - After Adding A File.zip (212.5 KB)

I agree with you there. My largest folder/library of movies is my non-animated movies, clocking in at 1143 items. 78 of those are folders, which each contain at least 3 movies (often more, such as the Marvel Cinematic Universe). Doing a scan of this folder, I do see Plex touch on every movie despite nothing changing (the “Activity” widget in the upper right claims “scanning MOVIE”, but it always finds the new content and all metadata within ~10 seconds.

If it exponentially gets longer, then I may get concerned if my library goes up to 4K movies or more. But if it’s a linear increase, then 4K movies taking ~40 seconds to scan for a new addition is fine by me. If anything, I may start to “genre-ize” my movie collection, placing movies into “action” or “comedy” rather than a single folder for every movie. Especially since I use no local metadata, I’m inclined right now to stick with what I am comfortable with.

I think the point here, is that it does not matter how you organise your folders so much, just as long as Plex is able to consistently find the media and deal with it appropriately.

Proper file naming is a must though, regardless of the folder structure, there is no way around that, IMHO.

I was considering changing my folder structure, but since there is no real benefit, for me at least, then why spend the time doing it now?

For any newcomers though, I would definitely recommend that you follow the Plex recommendations. That way, you are less likely to hit a brick wall when it comes to adding media and Plex failing to add or identify it correctly.

I did change my Music folder structure some time ago, as I had some inconsistencies before the change.

Since the change I have had no issues to speak of, except for those of the PEBKAC variety … lol

All of my Music follows the recommended structure now, even the singles.

Even if you do genre-ise your folders, I would probably keep the individual folder for each Movie as recommended, that way you can easily add ‘extras’ without having to re-organise things later on, if you wanted to.