Automated Updates of IPTV Channels in NPVR and Kodi via APIs - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: PVR & Live TV Support (https://forum.kodi.tv/forumdisplay.php?fid=167) +---- Forum: NextPVR (https://forum.kodi.tv/forumdisplay.php?fid=175) +---- Thread: Automated Updates of IPTV Channels in NPVR and Kodi via APIs (/showthread.php?tid=379440) |
Automated Updates of IPTV Channels in NPVR and Kodi via APIs - taylormia - 2024-11-17 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: Code: @echo off 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 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. 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, Kodi and NPVR devs for a great product. |