This repository provides a Kodi PVR addon for interfacing with the VBox Communications XTi TV Gateway devices. This README serves as a quick overview of the functionality and architecture of the addon, to make it easier for others to possible contribute.
Multiple VBox devices can be configured via Kodi PVR since Kodi 20 (Nexus). To setup multiple devices simply visit the add-ons settings under Configure
, and choose new Add add-on configuration
.
git clone --branch master https://github.com/xbmc/xbmc.git
git clone https://github.com/kodi-pvr/pvr.vbox.git
cd pvr.vbox && mkdir build && cd build
cmake -DADDONS_TO_BUILD=pvr.vbox -DADDON_SRC_PREFIX=../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../../xbmc/kodi-build/addons -DPACKAGE_ZIP=1 ../../xbmc/cmake/addons
make
In order to build the addon on mac the steps are different to Linux and Windows as the cmake command above will not produce an addon that will run in kodi. Instead using make directly as per the supported build steps for kodi on mac we can build the tools and just the addon on it's own. Following this we copy the addon into kodi. Note that we checkout kodi to a separate directory as this repo will only only be used to build the addon and nothing else.
cd $HOME
git clone https://github.com/xbmc/xbmc xbmc-addon
git clone https://github.com/kodi-pvr/pvr.vbox
cd $HOME/xbmc-addon/tools/depends
./bootstrap
./configure --host=x86_64-apple-darwin --with-platform=macos
make -j$(getconf _NPROCESSORS_ONLN)
cd $HOME/xbmc-addon
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons ADDONS="pvr.vbox" ADDON_SRC_PREFIX=$HOME
Note that the steps in the following section need to be performed before the addon is installed and you can run it in Kodi.
cd $HOME/pvr.vbox
./build-install-mac.sh ../xbmc-addon
If you would prefer to run the rebuild steps manually instead of using the above helper script check the appendix here
These instructions may be outdated. I'm assuming here that you'll check out all source code into C:\Projects
, you'll have to adjust that if you use another path.
C:\Projects\xbmc
) and make sure you have Microsoft Visual Studio 2013 installed.C:\Projects\pvr.vbox
)C:\Projects\xbmc\project\cmake\addons\addons
. You'll see there's a folder for each binary addon. In order to build your locally checked out copy of the addon instead of the version that is bundled with Kodi you'll need to open the file pvr.vbox/pvr.vbox.txt
and change its contents to the following: pvr.vbox file://C:/Projects/pvr.vbox
.C:\Projects\xbmc\tools\windows
. From here, run prepare-binary-addons-dev.bat clean
and then prepare-binary-addons-dev.bat pvr.vbox
.C:\Projects\xbmc\project\cmake\addons\build
and open and build the kodi-addons.sln
solution.C:\Projects\xbmc\addons
. If you run Kodi now from inside Visual Studio the addon will appear automatically under "System addons". If you don't want to bother compiling Kodi from source, install it as you normally would and copy the pvr.vbox
into %APPDATA%\Kodi\addons
.It's possible to configure the addon to connect to the VBox TV Gateway using both the local netowrk and via the internet address/port. This is useful for e.g. a laptop which is not permanently inside your internal network. When the addon starts it first attempts to make a connection using the local network settings. If that fails, it will try the internet settings instead. The addon restarts itself if the connection is lost so it will automatically switch back without having to restart Kodi.
Connection settings to use when connecting from your local network. For a local network connection the port values should not need to be modified.
80
.0
means this is disabled and HTTP will be used instead.55555
.3
.Connection settings to use when connecting from the internet. The ports should only need to change if you're using asymmetric port forwarding (e.g. port 8080 -> 80 and 12345 -> 55555). The HTTP port is used to communicate with the device while the UPnP port is used when streaming media.
0
means this is disabled and HTTP will be used instead.55555
.10
.Settings related to Channels & EPG.
LCN (Logical Channel Number) from backend
- The channel numbers as set on the backend.Channel index in backend
- Starting from 1 number the channels as per the order they appear on the backend.Settings related to the timeshift.
This addon has been built from the ground up using C++11. The main functionality is contained within the vbox
namespace, the only file outside that is client.cpp
which bridges the gap between the Kodi API and the API used by the main library class, vbox::VBox
. The idea is to keep the addon code as decoupled from Kodi as possible.
The addon communicates with a VBox TV Gateway using the TV gateway's HTTP API. Since the structure of the responses vary a little bit, a factory is used to construct meaningful objects to represent the various responses. All response-related code is located under the vbox::response
namespace.
The addon requires XMLTV parsing since that's the format the gateway provides EPG data over. The classes and utilities for handling this are kept separate under the xmltv
namespace so that the code can potentially be reused.
The vbox::VBox
class which client.cpp
interfaces with is designed so that an exception of base type VBoxException
(which is an extension of std::runtime_error
) is thrown whenever ever a request fails. A request can fail for various reasons:
Similar to the XMLTV code, the code for the timeshift buffer is fairly generic and lives in a separate timeshift
namespace. Currently there is a base class for all buffers and two implementations, a FilesystemBuffer
which buffers the data to a file on disc, and a DummyBuffer
which just relays the read operations to the underlying input handle. This is required since Kodi uses a different code paths depending on whether clients handle input streams on their own or not, and we need this particular code path for other features like signal status handling to work.
The addon follows semantic versioning. Each release is tagged with its respective version number. Since each release of Kodi requires a separate branch for the addon, the major version changes whenever the Kodi version changes. This means that versions 1.x.x
are for Kodi v15, versions 2.x.x
are for Kodi v16 and so on.
The code is licensed under the GNU GPL version 2 license.
The following steps can be followed manually instead of using the build-install-mac.sh
in the root of the addon repo after the initial addon build has been completed.
To rebuild the addon after changes
rm tools/depends/target/binary-addons/.installed-macosx*
make -j$(getconf _NPROCESSORS_ONLN) -C tools/depends/target/binary-addons ADDONS="pvr.vbox" ADDON_SRC_PREFIX=$HOME
or
cd tools/depends/target/binary-addons/macosx*
make
Copy the addon to the Kodi addon directory on Mac
rm -rf "$HOME/Library/Application Support/Kodi/addons/pvr.vbox"
cp -rf $HOME/xbmc-addon/addons/pvr.vbox "$HOME/Library/Application Support/Kodi/addons"