If you have items that seem to have been stuck forever in Plex’s “Recently Added” lists, editing the Plex database directly is the surest way to correct the problems. We’re going to use a combination of tools to determine what the problem is, and to correct it:
A MySQLite database editor:
An Epoch Unix Timestamp converter:
Windows Terminal (from the Microsoft Store) or the Command Prompt
The most likely reason for something to be perpetually in a Recently Added list is the value that was used for the “date added” is in the future. To determine if that’s the case for you, we’re going to take a look at the XML for a movie or TV Show. From the Plex webpage, click on one of the problem items in “Home – Recently Added”, and then click on the three dots near the thumbnail for the item:
From there we want “Get Info”, and then “View XML”. View XML gives us a look at what’s stored in the database for that media item:
In particular, let’s look at “addedAt=”, which will be in Unix Epoch Time format. Copy the number and paste it into the Epoch calculator referenced earlier in this post. Does this time make sense? In my case all of my problem items had dates well into the future. If this item needs fixing you’ll want to jot a number or two down, including “key=”, “parentKey=”, and “grandparentKey=” for tv shows — and you only need the numerical portion. For movies, “key=” is all you need.
Next let’s open the MySQLite browser you installed earlier, and click on “Open Database”. Browse to:
%USERPROFILE%\AppData\Local\Plex Media Server\Plug-in Support\Databases
Click on “Execute SQL” and let’s try a few queries. We’re not going to change anything through this interface, we’re just going to look at the data and test our logic for any changes we want to make. Don’t save any changes when you exit this application! The opened database should look like this:
and like this in “Execute SQL”:
The most basic query we’ll use is:
select * from metadata_items
Copy and paste the into the SQL box, press the Play icon, and you should get a full list of your database:
Let’s say from earlier analysis of the XML data that an episode with an ID # (from key=) of 6137 is the one we need to fix. We can now execute a more limited query of:
select * from metadata_items where id = 6137
Press the play icon and the result should be just the episode we want to modify.
Now would be a good time to close Plex Media Server, by right clicking on its icon in the System Tray and clicking close. You might also want to make a backup of the database file we opened, if you haven’t already done so.
Since Plex no longer allows certain types of operations through a generic MySQLite browser. We’ll keep the DB browser open so we can check our work, but we’ll need a Command Prompt window open as well to execute commands using Plex’s included MySQL binary. I’ll be using Windows Terminal to open a command prompt, but you can also just run “cmd” from the Windows search box.
We’ll be issuing commands from the command prompt in the following fashion:
"Plex SQLite.exe" "com.plexapp.plugins.library.db" "MySQLite commands"
We’ll be putting in the full path for the exe and db files though. Let’s try the same command we executed in the DB browser looking for just the one problem video:
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" "%USERPROFILE%\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db" "select * from metadata_items where id = 6137"
The result is not as easy to follow as the DB browser output, but at least we know everything is working properly from the command line. The easiest way to update a record that has an “addedAt” in the future, is to change that date to match the “originallyAvailableAt” date. The syntax, using our same example file, would be:
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" "%USERPROFILE%\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db" "update metadata_items set added_at = originally_available_at where id = 6137"
Execute that, using your own “id=” of course, and if it’s successful you’ll just get a new command prompt. However, you can go back to the DB Browser window, and do a query on that same record to see that the added_at value has changed to match the originally_available_at value.
Using these same commands, you can also change entire seasons at the same time, using the “parent_id=” variable instead of “id=”, and the appropriate number from an XML search. For now though, restart Plex Media Server, and you should see that your troublesome “Recently Added” item is no longer stubbornly at the front of the list!
If you have a large number of items that need to be modified, you should be able to use:
"C:\Program Files (x86)\Plex\Plex Media Server\Plex SQLite.exe" "%USERPROFILE%\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db" "update metadata_items set added_at = originally_available_at where added_at >= date('now')"
Always a good idea to test in the DB browser first though, and you would check this would only impact the records you want to modify by using the following in the DB Browser first:
select * from metadata_items where added_at >= date('now')
If the desired records are shown in the browser, you can execute the command line update with confidence.