I can no longer manually update the com.plexapp.plugins.library.db with sqlite3.
Any attempt to edit the database exits with “Error: unknown tokenizer: collating”.
Using a gui like sqlitebrowser produces a similar error.
(Libraries are updated ok when new content is added, btw.)
I just want to know how to get around the tokenizer error when manipulating the db from cli.
Any hints?
jim
I believe this is associated with improvements in how full-text searching is implemented.
There’s a new index, index_title_sort_icu. And two new virtual full-text-search tables, fts4_metadata_titles_icu and fts4_tag_titles_icu - that’s where the collating add-on tokenizer is being used.
Things I haven’t tested:
I wonder if dropping index_title_sort_icu and the fts4*icu virtual tables and associated triggers would work, if done correctly. Similar to how the Repair a Corrupt Database instructions have you drop index_title_sort_naturalsort.
There’s a big group of schema migrations associated with these. They all start with 500000000000 so it might be possible to do.
Hello, would someone be able to provide details steps & commands to modify the added_at after these new changes please? My server version is also 1.22.1.4200.
#!/bin/bash
SQLITE=/usr/lib/plexmediaserver/Plex\ Media\ Server
DB=./com.plexapp.plugins.library.db
cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases
"$SQLITE" --sqlite $DB "UPDATE metadata_items SET added_at = datetime(originally_available_at, '+1 days') WHERE id like 'YOUR-XML-ID';"
Is there a way to do this on Windows?
I’ve looked everywhere and can’t find any solutions to this. I also don’t see sqlite3.exe in any of the plex folders.
I too am having issues. This was a great workaround to modify newly added, older movies. I now plan to halt any new additions to the library until I’m able to do this again. This changed immediately after Plex was recently updated. I’m using version 1.22.1.4228.
Have tried on Mac at command line, got an initial message about address in use. Shutdown the app, ran ./Plex\ Media\ Server\ --sqlite ‘library location of DB’ ‘UPDATE STATEMENT’ but which would not return any error messages but start up the server and not much else. Used to find being able to run the command within DB Browser For SQLite very useful to keep the library tidy.
I’ve been using sqlite3.exe with PowerShell on Windows to update my Plex DB for a while now and it stopped working after a recent update.
I found this post and based on @Volts comment I was able to figure out how to get it working again using the Plex EXE.
Here is a basic command format I use on Windows and with PowerShell in case anyone is interested:
$PlexDB = “C:\Users\PLEX\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db”
$PlexEXE = “C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe”
$SQL = “SQLITE STATEMENT HERE”
I eventually discovered by deleting the trigger “fts4_metadata_titles_after_update_icu” while having the DB open in DB Browser, I could execute UPDATE “main”.“metadata_items” SET “added_at”=“originally_available_at” and then do a manual scan. Post scan I just ran the Create DDL for the trigger again:
CREATE TRIGGER fts4_metadata_titles_after_update_icu AFTER UPDATE ON metadata_items BEGIN INSERT INTO fts4_metadata_titles_icu(docid, title, title_sort, original_title) VALUES(new.rowid, new.title, new.title_sort, new.original_title); END
I’ve been having issues trying to run this via Windows CMD. If I run the following command, nothing happens and the prompt just returns back to normal (it in fact looks like it just fires up another instance of the PMS process), querying the DB after I can see nothing updated. Are any other windows admins still having trouble?
“C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe” --sqlite “C:\Users\david\AppData\Local\Plex Media Server\Plug-in Support\Databases\com.plexapp.plugins.library.db” “update metadata_items set user_fields = ‘lockedFields=305’ where id = 488795 and metadata_type = 8”