Most people consider themselves lucky if they can get one PVR backend to work, but sometimes it makes things easier if you can run two different TVHeadEnd backends and let Kodi access both of them. Unfortunately, Kodi works best with a single PVR backend, although that seems to be less true in Kodi Isengard than in previous versions.
Why would you want to run two different backends? There are many reasons, but a primary one is proximity to an antenna or satellite dish. As just one example, say you want to receive terrestrial television signals using a TV tuner card or device, and also satellite signals from your satellite dish, but the two are nowhere near each other. Maybe your antenna is located right next to your house, but in order to clear a hill or other obstruction, your dish has to be placed several hundred feet away. You don’t want to run several hundred feet of RG-6 cable if you can help it, because the signal loss would be quite significant. A better solution would be to place a backend server in some kind of climate controlled (or at least waterproof) enclosure near the dish, and then connect that server to your local network using a fiber optic cable. But you’d also need a second backend server at your house, to receive signals from your antenna (well, unless you are using networked tuners such as HDHomeRun devices from SiliconDust, but this is just an example).
Note that some people actually have a second TVHeadEnd backend at a completely separate geographical location, maybe in another city, or even another state or country, and connect to it over the Internet. But, I don’t recommend that unless you’re not subject to ISP usage caps at either end, or you use compression (but that’s beyond the scope of this article). And anyway, that’s the beauty of receiving signals from the satellites – they can be viewed from a very wide geographic area, as long as there aren’t any obstructions between your dish and the satellite.
Whatever the reason you need two backends, Kodi doesn’t give you a readily apparent way to use both easily. However, there is a method that works in some Kodi and XBMC installations. I don’t know why it works great on some systems and not so well others, all I can suggest is that if you find yourself with this need, try this and see what happens.
Note that I am only giving instructions here for Linux and OS X systems. It should also be possible to do this on other platforms, but since I don’t use those, I don’t know the correct paths.
In Linux, copy /usr/share/kodi/addons/pvr.hts to pvr.hts2 in the same (/usr/share/kodi/addons/) directory. You will have to be a system administrator to do this (use sudo). The .hts2 ending is somewhat arbitrary; you could also call it something descriptive like pvr.htsantenna if you like, but if you change it make sure you follow that same naming convention everywhere. I’ll assume you’ve used pvr.hts2 for the balance of these instructions. In OS X you do the same thing, except the original file is at /Applications/Kodi.app/Contents/Resources/Kodi/addons/pvr.hts and again you make a copy in the same directory. Note that you are copying an entire directory, not an individual file. I tend to do things like this in Midnight Commander because I find it easier than trying to remember the correct Linux command line syntax, but if you are a command line devotee you’re welcome to do it from there.
Next, change to the copied directory (pvr.hts2 in this example) and find a file inside named addon.xml. You want to edit this file, so do something like sudo nano addon.xml (or use your favorite text editor, or highlight the file and press F4 inside Midnight Commander), and change two values, specifically the “id” and “name” strings. Change the id to match the name of the newly-copied directory (pvr.hts2 in this example), and change the “name” to somehow differentiate the copied addon from the original. For example, you could add the word (antenna) or (satellite) to the end of the string.
You should do the following steps as a user: In Linux, copy the ~/.kodi/userdata/addon_data/pvr.hts directory to pvr.hts2, or in OS X copy the ~/Library/Application Support/Kodi/userdata/addon_data/pvr.hts to pvr.hts2. In both cases, the copied directory should be in the same directory as the original, similar to the way you did it in the first step but don’t do it as an administrator, in other words, don’t use sudo.
Now go into the directory you just copied and edit the settings.xml file (same as the way you edited addon.xml but again don’t do it as an administrator). You will likely need to edit the “host” value to point to your second backend, and you may also need to edit the “pass” and “user” values if the backend requires a username or password for access. Note you can also change these items from inside Kodi using the second addon’s configuration page, if you prefer, but it’s probably better to at least change the host address before you start it up so you don’t have two addons trying to access the same server.
In many cases, this is all you need to do, other than go into Kodi’s PVR addons and make sure that both are enabled and have the correct configuration settings. You will see your channel list populated with channel numbers from both backends, and you will see recordings from both backends, etc. But on some Linux-based systems, there is one additional directory that must be copied, as an administrator. This directory is at /usr/lib/kodi/addons/pvr.hts and you’d again copy the entire pvr.hts directory to pvr.hts2 in the same (/usr/lib/kodi/addons) directory. I have no idea why this additional step is necessary with some systems but not others. And this doesn’t seem to apply to OS X – if there’s an equivalent directory there, I haven’t been able to find it.
As I noted, this same technique should work with Kodi on other platforms if you can find the correct equivalent directories. Note that you will need to repeat these steps any time you upgrade Kodi to a newer version, unless you are using Linux. Under Linux, you will need to repeat these steps only when the TVHeadEnd PVR addon is updated. And in either case you will likely only need to repeat the steps that require administrator access; the settings in the userdata directory shouldn’t be affected by a software update.
It goes without saying that I do not guarantee this will work. I’m not a programmer, so if it doesn’t work for you, all I can suggest is you go into the Kodi PVR forum and add your support to this thread, which actually provided some of the information in this article.