Database, date added breaks again during adding media

Server Version#: 1.28.0
Player Version#: Plex Web 4.84.1

I’m running PMS on a QNAP TS-253A with QTS 5.0.1.2173.
In August 2022, I posted about database corruption that I was not able to recover from!
This this time I uninstalled the PMS application, deleted all folder content from the PMS folder, and give it another try to use PMS.

After pointing to some decade old media collection on the same NAS as PMS, the first movies show up as added 18 years ago. Then, for no obvious reason, media shows up as added “a few seconds ago”!

This is driving me nuts! Why is there not an option to force reading the file modified date?

In the database table “metadata_items” I’m looking if overwriting the UNIX time “created_at” with “added_at” or “originally_available_at” would make sense.
But without knowing the cause for the above mentioned problem, I doubt this is a proper solution.

So, please give me some advice how to fix this for ever.

BTW, my filesystem uses this date/time formatting: 2010-07-26 17:11:19 “%Y-%m-%d %H:%M:%S”

Many folks have been working around this for years and there are many topics in the forum on it. The metadata_items table is the one you want to change along with added_at. Something like the following will do it which will set added_at = originally_available_at

UPDATE metadata_items SET added_at = originally_available_at WHERE added_at <> originally_available_at AND originally_available_at IS NOT NULL AND library_section_id = 1;

BTW… library_section_id will be different for you. 1 is my movies library but it could be something else for you.

However, I’ve rebuilt my server more times than I can remember and the recently added does respect my NAS filesystem dates for my media. I have found what is IMPORTANT is to full disable (set to NEVER) the library heavy duty tasks until AFTER all libraries are created and the first matching metadata fetch is complete. I also have only one library per type so that probably helps with this also.

Anyhow, passing along my knowledge in the hope it might help a little.

Thank you @anon5074910 , I already found some of these topics.
Your SQL command, looks better than the older solutions I found.
My library_sections_id lists only 5 and 7 (I wonder why it doesn’t start at 0).

Using the originally_available_at is kinda awkward workaround especially when media was released before the computer era :wink:

I’ll try once more with these heavy duty tasks disabled, for it makes sense the software choked and start misbehaving.
I can only only find 3 options from your screenshot. I guess you’re using another PMS version?

Turned off all heavy tasks, added music starting with 0-9 and all went well (some added to my collection 19 years ago) . But when adding music starting with A, it showed as being added today to my collection!
It seems PMS just doesn’t respect my filesystem.

I followed this tutorial for manipulating the database https://support.plex.tv/articles/repair-a-corrupted-database/
Note that to use the Plex SQLite on Linux machines, you need to do that as sudo.

sudo "/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Plex SQLite" com.plexapp.plugins.library.db

This is still not a proper solution, and I hope some PMS guru can come up with a better solution to have a way for accessing fresh added media.

Curious. What version of plex server do you have installed ?

I don’t run plex directly on my NAS so maybe the date stuff is a side effect of that. Let’s see if someone else has an idea.

Version is as mentioned in opening post, provided by QNAP AppCenter.

All my music is now added to the database with proper modify file date!
Movies are still not okay.

I decided not to use originally_available_at date for added_at because that is already the column being used for sorting by release date!

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