NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Kodi / XBMC v
1 2 3 4 5 … 44 Next »
Automated Updates of IPTV Channels in NPVR and Kodi via APIs

 
  • 0 Vote(s) - 0 Average
Automated Updates of IPTV Channels in NPVR and Kodi via APIs
taylormia
Offline

Junior Member

United States
Posts: 39
Threads: 5
Joined: Apr 2022
#1
2024-11-17, 08:53 PM (This post was last modified: 2024-11-21, 11:50 PM by taylormia.)
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
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. 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.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 54,342
Threads: 971
Joined: May 2006
#2
2025-11-04, 01:32 PM
(2025-11-04, 10:09 AM)Sophiana Wrote: If I change the update frequency of IPTVBoss from every four hours to every two hours, how would this affect system performance and the accuracy of the M3U and XML files?

I don't recall why I put the OP on my ignore list and you could be a spammer but reading the notes, starting in Kodi Piers EPG changes with channel changes have triggered a channel update in Kodi.

Regarding the question XMLTV files historically have not been that dynamic, but now that IPTV is offering event based programming that concept has changed somewhat and I have discussed some future changes that could potentially work  better with events. This will likely need to have the support of community members who need in to best define all the use cases.

EPG and channel updates are in themselves not performance issues unless you get into the lists that become in the 1000s and even tens of thousand of channels.  You would not want to update large lists frequently.  


Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 107,240
Threads: 774
Joined: Nov 2003
#3
2025-11-04, 06:38 PM
They were spam. I could see a couple of extra links hidden in their quote stuff, so I banned them and deleted the posts.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Kodi Recurring Recordings (Default Type) Fillimerica 2 321 2025-10-21, 07:34 PM
Last Post: mvallevand
  Suggestions for the KODI Add-on Escape7 57 16,732 2025-09-23, 12:10 AM
Last Post: mvallevand
  Channel and Show Icons wrong in Kodi muzicman0 44 4,764 2025-09-22, 03:26 PM
Last Post: mvallevand
  kodi crashes when watching HD Blinker 0 758 2025-07-30, 02:24 AM
Last Post: Blinker
  Seeking Guidance on Recording Settings for IPTV Channels Gonvir 3 1,492 2025-04-22, 10:22 PM
Last Post: sub
  Kodi Channel not updating aTF6i 2 1,355 2025-03-09, 12:26 AM
Last Post: aTF6i
  EPG not loading in Kodi? membball84 3 1,542 2025-02-13, 01:24 AM
Last Post: membball84
  Kodi 22 (Piers) and library thumbnails mvallevand 8 2,845 2025-01-15, 06:32 PM
Last Post: mvallevand
  Kodi Channel Icons wrong and can't be corrected wapkaplet 11 2,889 2024-10-23, 02:11 PM
Last Post: mvallevand
Shocked Only Pulling in "All Channels" membball84 9 2,251 2024-09-24, 05:04 PM
Last Post: mvallevand

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode