Plex Will No Longer Add HDHomeRun as DVR

I recently had to reinstall Windows 10. Previous to this my Plex server with my HDHomeRun CONNECT Quatro worked fine. I keep the local app data on a separate internal drive so that in the past when I’ve had to reinstall Windows, getting Plex running mostly consisted of installing the server and pointing the app data to the right location.

Last week something different happened. After pointing the local app data to the right directory, my media loaded like normal but I could no longer add my DVR. I am having the exact same issue as described in this post: Cannot set up live TV & DVR

Now, before I have to delete my entire library just to add the DVR, are there other steps I could try? Deleting the whole set up feels like a nuclear option. Would love for someone from Plex to weigh in on this since it’s happening to more than one person.

Did you check the Windows Firewall?
After a new Windows installation, your network connection is often still classified as ‘public’, which closes all ports and makes it impossible to discover the HDhomerun (among other things).

The firewall is set to private but thanks for mentioning that as a possibility. The odd part about all of this is the native HDHomeRun Windows 10 app works fine but the PMS can’t seem to communicate with the HDHomeRun properly. It’ll fool you into thinking the manual setup works only it never gets past the screen where you have to click “close” as “view guide” is grayed out.

Good, then we will try something more complicated, before you nuke everything.

We will be performing a database repair, with some additional commands thrown in.
The procedure is based on the offical guide
https://support.plex.tv/articles/201100678-repair-a-corrupt-database/
See this article for basic knowledge about how to find the database file and where to download the required software tool.

After you have extracted the sqlite.exe into the right folder,
open a command line window (cmd.exe),
navigate to the correct drive and folder

cd "%LOCALAPPDATA%\Plex Media Server\Plug-in Support\Databases"

(if you have customized the location of your Plex data folder, you’ll have to navigate there on your own)

copy each of the following commands into it and submit them by pressing Enter

Shut down Plex Server before doing any of the below:

First some additional commands which are required for Server versions after 1.13.1

sqlite3 com.plexapp.plugins.library.db "DROP index 'index_title_sort_naturalsort'"
sqlite3 com.plexapp.plugins.library.db "DELETE from schema_migrations where version='20180501000000'"

It is of utmost importance, that all of the commands are copied exactly as written, because they alter the database directly. Make sure to copy the complete line and not only the part that is visible on a smaller screen.

Now run an integrity check on the DB file

sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check"

On to the actual repair procedure.
export the DB to SQL file:

sqlite3 com.plexapp.plugins.library.db .dump > dump.sql 

Now rename the original, potentially corrupted DB file

rename com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original

reimport the SQL dump back into a new DB file:

sqlite3 com.plexapp.plugins.library.db < dump.sql

Run another check to establish if repair was successful

sqlite3 com.plexapp.plugins.library.db "PRAGMA integrity_check"

Now let’s throw away everything related to the DVR/live TV feature:

DELETE FROM media_provider_resources

at the end of the procedure, move these files out to a safe place (outside of Plex’s data), just in case you want to revert it:

com.plexapp.plugins.library.db-shm
com.plexapp.plugins.library.db-wal
com.plexapp.plugins.library.db.original
tv.plex.providers.epg.xxxxxxxxxxxxxxxxxxxxx.db
tv.plex.providers.epg.xxxxxxxxxxxxxxxxxxxxx.db-shm
tv.plex.providers.epg.xxxxxxxxxxxxxxxxxxxxx.db-wal

Now, you can restart Plex. Allow it to sit for several minutes, because it has to rebuild some index tables in the database which were cleared out by the previous procedure.

1 Like

Thanks again for your help! I get as far as the part where I need to re-import the SQL dump into the new DB file before getting an error in PowerShell that reads:

At line:1 char:42
+ .\sqlite3 com.plexapp.plugins.library.db < dump.sql
+                                          ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RedirectionNotSupported

And when I try in Command Prompt I get this error:
Error: near line 1: near "??P": syntax error

Not powershell.
Good old DOS prompt. cmd.exe

As I said below that, the Command Prompt is giving me
Error: near line 1: near "??P": syntax error

what is the exact command line ?

and if you browse dump.sql contents - what does it have in first few lines?

sqlite3 com.plexapp.plugins.library.db < dump.sql

and the first few lines of the dump.sql file are:

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "schema_migrations" ("version" varchar(255) NOT NULL, 'rollback_sql' text default NULL, 'optimize_on_rollback' boolean default NULL);

All i can suggest is send zip of the dump.sql to one of us by PM and will see if we get the same error

Are you running with the current version of sqlite3 ?

Yes, I grabbed the sqlite3 as linked from the https://support.plex.tv/articles/201100678-repair-a-corrupt-database/ article. It’s listed as sqlite-tools-win32-x86-3240000.zip which appears to be the latest version, 3.24.0. I will send over the zip now. Thanks again for your help.

I got the same error

Looking at the dump file with hex editor shows that each text character is two characters long and the file starts with Hex FF FE

Must be to do with character encoding

Seems to be UTF-16

Did you set that ?

I only followed the instructions present so not sure how that happened. I got the file you sent back that was encoded in UTF-8 but when I try to run the command to re-import the SQL dump to the new DB I get a ton of errors that read: Error: near line XXXXXXX: file is not a database

Is it windows that you run on ? And the dump was created in windows ?

What is the system default character set ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.