r/PleX•
SerLevArris

Changing Date Added on Media to Affect Recently Added List

Tips

I just made this post in another topic, but figured I'd jam it in it's own OP as it might be useful to someone later on.

If you have ever migrated lots of movie files, or had to do the Plex Dance, sometimes your "Recently added" list gets out of whack and if it bothers you enough, you can use this method to modify the Plex database.

I went through this process myself after migrating from win10 to synology, and ended up doing this.

I am also considering doing it again as I just recently added in about 20 Barbie movies for my nieces and they are now clogging up the "Recently Added" list....

I figured this out from reading this post:

https://www.reddit.com/r/PleX/comments/4yrt0n/manipulating_date_added_for_media_files/

 

  1. Stop PMS.

  2. Copy database file "com.plexapp.plugins.library.db" off to play with (can find database file here depending on platform). For Synology the database file is located here "/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases"

  3. Make simple file backup copy of database file, just in case you bork it up.

  4. Download and install SQLiteSpy.

  5. Run SQLiteSpy, open/point at the "com.plexapp.plugins.library.db" file.

  6. Make changes to database.

  7. Copy database file back to PMS platform.

  8. Restart PMS.

  9. Profit.

 

This is the SQL I ended up using to "fix" my movie and tv show added date:

 

Check selection/check after running update

SELECT * FROM metadata_items
WHERE originally_available_at is not null AND (guid LIKE '%imdb%' OR (guid LIKE '%thetvdb%' AND year IN ('2018','2019')))
ORDER BY guid, year;

 

Update database

UPDATE metadata_items
SET added_at = originally_available_at
WHERE originally_available_at is not null AND (guid LIKE '%imdb%' OR (guid LIKE '%thetvdb%' AND year IN ('2018','2019')));

 

The SELECT is pretty broad strokes, mainly because I couldn't be bothered narrowing it down any more. If you want to restrict it to only Movies instead of hitting TV Shows as well, just use this SELECT instead:

UPDATE metadata_items
SET added_at = originally_available_at
WHERE originally_available_at is not null AND guid LIKE '%imdb%';

 

There is also more detail here about directly getting to the database to make the change via SSH:

https://www.reddit.com/r/PleX/comments/7mys3n/how_to_change_the_date_on_added_media_so_it_sorts/

I prefer pulling the database off the device itself to muck with it as it feels a bit safer to me being able to make quick file copies as backups.

Posted Apr 25, 2019, 1:42 AM UTC · edited

32
TopSecretSpy12TBs of video and counting...•

As the person who posted the latter link about making the changes via SSH, I'm happy to see that people are expanding upon what's already put out there.I still find that I edit directly about once every 2-3 months, usually after a batch add. In fact, I did so about 30 minutes before this post, because I moved several shows into their own separate library.

I've also found that "SET added_at=originally_available_at WHERE added_at<>originally_available_at AND originally_available_at IS NOT NULL" is often a more complete and simple approach than what I wrote back then.

2
SerLevArrisOP•

Yeah good point, no reason to update when no change required. It's a pretty quick update at any rate.

1