NextPVR version 7.0.0.241105 and Kodi version 21.1 (Omega) both on Win10.
Since some of my IPTV sources change their URLs and tokens regularly, I had three goals:
1. Create "clean" M3U (playlist) and XML (EPG) files for the specific channels and groups I want and automate keeping these files updated.
2. Automate the process of doing an "Update Channels" on the NPVR IPTV devices as well as the EPG.
3. Automate the process of updating the channel list and EPG on Kodi PVR & LiveTV.
Solution for goal 1:
I use the IPTVBoss application on Docker - which allows editing, organizing and syncing IPTV sources, to produce clean and updated M3U and XML files for existing channels. In my environment, IPTVBoss is scheduled to sync all M3U and EPG sources and create the refreshed M3U and XML files at four hour intervals.
If there are additions or deletions of channels, it would require a manual process in IPTVBoss and NPVR to make the changes.
Solution for goal 2:
This is accomplished with NPVR API commands using NScriptHelper.exe. Thanks to the NPVR devs for pointing me in this direction. A batch file that updates existing channels on IPTV devices and updates the EPG is set to run six times a day with Task Scheduler five minutes after the IPTVBoss updates. Here's the batch file:
Solution for goal 3:
Although NPVR has been updated with the refreshed channel URLs and EPG, Kodi PVR & LiveTV is not updated automatically with this info. This can be solved by either doing a "Clear Data" in the the Kodi PVR & LiveTV General menu or disabling and enabling the NPVR addon. AFAIK, the "Clear Data" function cannot be automated via the Kodi API. But, the disabling/enabling of the NPVR addon can be done with an API call.
The relevant Kodi API call is Addons.SetAddonEnabled
I use Home Assistant for home automation and so, I created this HA script that runs one minute after the NPVR updates. It uses the API to disable and enable the NPVR addon on three Kodi devices, with 5 seconds between the two actions.
One caveat. If LiveTV is being played when the NPVR addon is disabled/enabled, the stream is stopped. The stream can then be restarted manually. For me, this is a small intrusion which I can live with.
I hope the NPVR devs consider building into the app the capability to automate existing channel changes and also to propagate these changes to the Kodi PVR & LiveTV without needing to manually "Clear Data" in the app or to disable/enable the NPVR addon.
I will say that even with the "limitations" mentioned above, NextPVR is the easiest app/addon to use for IPTV, Live TV and Recording from a Kodi perspective. I have tried both MythTV previously and recently tested TVHeadend.
Thank you, NPVR devs, for a great product.
Since some of my IPTV sources change their URLs and tokens regularly, I had three goals:
1. Create "clean" M3U (playlist) and XML (EPG) files for the specific channels and groups I want and automate keeping these files updated.
2. Automate the process of doing an "Update Channels" on the NPVR IPTV devices as well as the EPG.
3. Automate the process of updating the channel list and EPG on Kodi PVR & LiveTV.
Solution for goal 1:
I use the IPTVBoss application on Docker - which allows editing, organizing and syncing IPTV sources, to produce clean and updated M3U and XML files for existing channels. In my environment, IPTVBoss is scheduled to sync all M3U and EPG sources and create the refreshed M3U and XML files at four hour intervals.
If there are additions or deletions of channels, it would require a manual process in IPTVBoss and NPVR to make the changes.
Solution for goal 2:
This is accomplished with NPVR API commands using NScriptHelper.exe. Thanks to the NPVR devs for pointing me in this direction. A batch file that updates existing channels on IPTV devices and updates the EPG is set to run six times a day with Task Scheduler five minutes after the IPTVBoss updates. Here's the batch file:
Code:
@echo off
cd /d "C:\Program Files\NextPVR"
(
echo %DATE% %TIME%
NScriptHelper.exe "-service:method=setting.m3u.update"
timeout /t 15 /nobreak > NUL
echo %DATE% %TIME%
NScriptHelper.exe "-service:method=system.epg.update"
) >> c:\nscripthelper.log 2>&1
Solution for goal 3:
Although NPVR has been updated with the refreshed channel URLs and EPG, Kodi PVR & LiveTV is not updated automatically with this info. This can be solved by either doing a "Clear Data" in the the Kodi PVR & LiveTV General menu or disabling and enabling the NPVR addon. AFAIK, the "Clear Data" function cannot be automated via the Kodi API. But, the disabling/enabling of the NPVR addon can be done with an API call.
The relevant Kodi API call is Addons.SetAddonEnabled
I use Home Assistant for home automation and so, I created this HA script that runs one minute after the NPVR updates. It uses the API to disable and enable the NPVR addon on three Kodi devices, with 5 seconds between the two actions.
Code:
alias: Toggle Kodi NPVR Addon
sequence:
- service: kodi.call_method
data:
method: Addons.SetAddonEnabled
addonid: pvr.nextpvr
enabled: false
target:
entity_id:
- media_player.familyroom_kodi
- media_player.kitchen_kodi
- media_player.bedroom_kodi
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: kodi.call_method
data:
method: Addons.SetAddonEnabled
addonid: pvr.nextpvr
enabled: true
target:
entity_id:
- media_player.familyroom_kodi
- media_player.kitchen_kodi
- media_player.bedroom_kodi
mode: single
One caveat. If LiveTV is being played when the NPVR addon is disabled/enabled, the stream is stopped. The stream can then be restarted manually. For me, this is a small intrusion which I can live with.
I hope the NPVR devs consider building into the app the capability to automate existing channel changes and also to propagate these changes to the Kodi PVR & LiveTV without needing to manually "Clear Data" in the app or to disable/enable the NPVR addon.
I will say that even with the "limitations" mentioned above, NextPVR is the easiest app/addon to use for IPTV, Live TV and Recording from a Kodi perspective. I have tried both MythTV previously and recently tested TVHeadend.
Thank you, NPVR devs, for a great product.