I recently created a new Plex Server docker image for my movie library. Since it was already 500+ movies, the “Date Added” was wildly off for all of them. Some were the date the library was created, some years ago. It was a mess.
I prefer viewing my library sorted by Date Added. If it had stayed this way I would’ve probably abandoned Plex. So I created a solution. I leave this hacky Python code for anyone else who runs into this problem.
I did search this forum, Reddit, etc. for solutions. This is what led me to at least understand how Plex’s SQLite database works but I did not find any decent fix for the entire database. If there is a simpler solution, let me know.
Note: This works running on OSX and probably Linux (untested) Windows does not seem to like piping commands into another program or something.
What it does:
It will loop through the movies folder, and use the date each movie’s folder was created. It passes a command into Plex SQLite telling it to update the added_at entry for that movie.
It makes a regular expression out of the folder’s name, so “Kill Bill Vol 1” will match the database’s title “Kill Bill: Vol. 1”
As it is now, it will not account for characters with accents on it. The folder “Amelie” won’t match the database’s “Amélie”. It also will not work for folders with different wording than the database’s so “Raid Redemption” and the database’s title “The Raid” won’t be a match.
I personally just ran this script and then manually fixed the ones that it didn’t fix. The readme file has the command template you can use for manually fixing one title at a time.
Just follow the instructions and fill in the location variables accurately before you run the python file.
Good question. I’m new to Plex so I’ve never used the Smart Collection feature. It sounds like it’s still filtering based on the records in the database, no? I was adding 500+ movies at once so many of them showed as being added the day I created the Plex library and some were random dates years ago.
It did sort by Date Released properly but that’s just not typically how I like to view the library. Date Added shows most recently added movies at the top of the list. Maybe I’m an outlier but I like being able to do that.
After checking out Smart Collections, I don’t think this solves the problem I had. When you create a smart collection for anything after whatever date, it’s still relying on what the “Date Added” is in the database. In mine, that was what was messed up. I had created a fresh Plex library with hundreds of movies already so, as far as Plex was concerned, they were all added in one day. Still doesn’t explain why the Date Added was years ago for some but whatever.
I had been using another movie server software previously. I just wanted to be able to keep the “history” of when movies were added to my hard drive/collection.
The only solution I found, digging through this forum, was editing the SQLite database manually. So my Python script was a way to automate doing this for all (or most) of my movies.
Edit: I know this is probably not a problem most people are having but, when I started searching around about the issue, other people definitely had also asked about it. I just figured I’d post my solution for whomever Googles it next.