The Dutch public broadcast corporation (NPO) is quite good at offering digital solutions to watch publicly funded TV shows. It offers a wide variety of different apps for different platforms, such as smart TV’s, mobile devices and browser. For watching television, I am happily using a 2009 Samsung smart TV. And yes, you guessed it, the smart-component is completely useless in 2023. Let’s see what we can do to enhance the NPO Start Live TV experience, but without smart devices, cable TV providers and big tech.

Kodi

Formerly known as XBMC, Kodi is the open source entertainment system that runs on different platforms. By installing it on a Raspberry PI, you will have a great entertainment ecosystem that plays all types of video’s, can be controlled with the remote of your television and is able to run add-ons. Playing video’s is nice, but the add-ons will enable you to interact with all kinds of digital services.

Pick any video-on-demand provider or website, and the odds are high that someone wrote an add-on for that particular service. Just to give you an example: Youtube, Netflix, HBO, FOX sports, Dumpert and NPO Start are all available. NPO Start support is part of the Retrospect plugin

Retrospect

Retrospect did a very good job at implementing the streams of national broadcasting companies, such as The Netherlands, Belgium, Great Britain, Norway and Sweden. It offers an easy to navigate menu structure and the possibility to watch live channels.


However, Retrospect is currently not integrated with the IPTV-component in Kodi. Therefore, the experience of zapping through channels and browsing the EPG could be improved.

IPTV Manager

Kodi also offers linear TV functionality, this enables you to plug in a USB DVB receiver and watch live television. However, in the current era of streaming services, DVB is not that relevant any more. Some countries, such as Belgium, have already phased out DVB-T.

Fortunately, there is also an add-on available that enables us to watch IPTV-streams on Kodi. This add-on, which is called IPTV Simple, allows us to open a m3u8 playlist file containing video streams and zap through them. But for using this add-on, you need to have a static file containing these stream URL’s. It is not that convenient if you need to create those files yourself.

This is where IPTV Manager jumps in, IPTV Manager does exactly what you might expect. It controls the streams and EPG of IPTV Simple programmatically. It can even query existing video add-ons for support and fetch the streams and EPG.

This is exactly what we need. We have already an add-on that allows us to stream live NPO channels, and we do have add-ons that allow us to integrate it with the IPTV functionality. So basically, we meet all the criteria to make it work, but we need to make the add-ons talk to each other.

graph TD; id1[IPTV Simple]-->Kodi; id2[IPTV Manager]-->id1[IPTV Simple]; Retrospect-->Kodi; Retrospect-.->id2[IPTV Manager]; id2[IPTV Manager]-.->Retrospect;

The dotted lines are the parts that are still missing in Retrospect.

Building the thing

It took me a couple of hours to dive into the Kodi ecosystem, as I had never worked on an Kodi or an add-on before. I was really surprised that it is all just Python that is being executed. You can modify the source code of any installed add-on by just editing the source files under .kodi/addons/.

Luckily, I could cheat by looking at the implementation of a similar add-on. By browsing around, I figured out that the hardest part would probably to integrate the functionality nicely into Retrospect. For example, in Retrospect it is not as straight forwarded to start a livestream by a URI. You need to mark a certain MediaItem as favourite first, before you can start it immediately.

Before starting working on the PR, I contacted Bas to ask him if he would be open to such functionality. He is really nice and helpful and gave me some advice on the actual implementation.

After some struggling with existing web scrapers, I found out that there is an actual API that we can make use of. After a couple of hours, I got the basic functionality working.

Final thoughts

I am still busy finishing up the functionality, but what I think is great is that I am already using it on a daily basis. The experience of watching linear television is more polished right now and the possibility of browsing the EPG just like when using a television receiver is very convenient. Moreover, I think it is nice to make yourself familiar with different types of (open source) software projects. It helps you to get better at understanding something that someone else built.