Move DVR media

Solved this by screwing with the database.

First editing the media_parts table following instructions here: [HowTo] Plex database modification - Moving media the right/wrong way - #10 by jelwell

I didn’t have to do any of the other 4 updates in that post (I already manually updated the library paths and the others didn’t apply).

Then I had to NULL out the deleted_at values in the media_parts AND media_items tables.

No idea why scanning the library didn’t un-delete the files after it “should have” found them again. Maybe a bug in the server?

Edit: This took a little bit more screwing around as after a little bit the libraries with the DVRed items became completely corrupted. Good thing I copied the DB before doing anything.

I think this resolves it, starting from the original database. I ran the following commands with current directory where the database is stored (have a backup).

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE metadata_items SET deleted_at= NULL"

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE media_items SET deleted_at= NULL"

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE media_parts SET deleted_at= NULL"

"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -sqlite "com.plexapp.plugins.library.db" "UPDATE media_parts SET file= replace(file, 'L:\Libraries\Media\Videos\DVR\', 'L:\Media\Videos\DVR\') where file like '%L:\Libraries\Media\Videos\DVR\%'"

In the final command you’ll need to replace your original and new paths accordingly.

Basically this edit is the same as the original but I also had to NULL the deleted_at values in the metadata_items table. I ended up using the plex -sqlite command to do this because of a tokenizer error when attempting in DB Browser for SQLLite. This comment pointed me in the right direction (Can no longer update library database with sqlite3 - #30 by bpalloni).

I will update this again if I have further issues, but I feel confident this is resolved this time.