PVR "Clear Data" via API or Programmatically
#1
I'm on Windows Kodi 21.1 Omega. Is there a way to trigger the PVR "Clear Data" function via an API call or in some other programmatic method. I would like to do this to update the PVR channels, groups, epg etc. that are made via the NextPVR backend.

Image
Reply
#2
No, that’s not possible currently. Do you want to use that API on a regular base to „fix“ something? If so you rather should open an issue so the root cause of your problem can be fixed.

Need to clean the db is most of the time a sign for a bug somewhere.
Reply
#3
Thank you. I don't believe this is a bug in Kodi. The NextPVR addon gets refreshed channels, EPG etc. periodically but those updates do not get propagated to the Kodi EPG unless one of the following happens:
1. The NextPVR addon is disabled and re-enabled
2. Kodi is restarted
3. "Clear Data" is invoked in PVR & LiveTV

I'm looking for a way to automate the refreshing of the Kodi EPG, channels etc. whenever the NextPVR addon has updated info. I know that there is an API call to enable/disable an addon. I may have to go that route to solve the problem.
Reply
#4
To me what you describe reads like a bug, because for other addons like pvr.hts this works. The addon API allows the addon to trigger data update from Kodi at any point in time, so that Kodi gets latest data the addon has. But the addon needs to tell Kodi that there is new/changed data.

EDIT: Exception is refresh of EPG data simple way. There, Kodi polls new data with a user customizable interval. There is also a "new" (like 5+ years old) API for async EPG transfer. Don't know whether the nextpvr addon uses that.
Reply
#5
@ksooo I directed him here from from the nextpvr forum for the json-rpc call question.

Perhaps you can tell me the issue with pvr.nextpvr and the nextpvr backend.  Basically pvr.nextpvr assumes the channel list is relatively stable and only updates the lists when core pulls it or the users manually force it through menu hooks.  This user is doing something pretty unique and manipulate the channel list via the API with the EPG update.  Normally with the static list an URL's change wouldn't impact Kodi but in the worst case there is a possibility the the channel.list is completely rewritten with every EPG update with every ID changing.  There is no API from the backend telling me the channel list has been updated.  In Piers I do store a value I could use as a flag but I want to avoid calling that on each EPG update poll from core.  Unfortunately some IPTV users have ridiculously large lists.

The best analogy I have is this code in pvr.iptvsimple https://github.com/kodi-pvr/pvr.iptvsimp...r.cpp#L593 https://github.com/kodi-pvr/pvr.iptvsimp...r.cpp#L593 except the playlist changes in NextPVR and the OP has indicated it is multiple playlists.

To complicate it pvr.nextpvr, timers need to be reset, but the timer rules do not.  So pretty much it will require an EPG db and TV db reset as well as a removal of anything in the texture cache related to channels.  I am assuming reminders clean up on their own when ID's are not found. 

I know on startup Kodi does an orderly sequenced load but I am not sure if I was to do the all the required triggers when I detect a channel list change if the triggers will happen in order.  I am also not sure how to avoid sending these triggers on startup.  

Martin
Reply
#6
Response edited below.
Reply
#7
(2024-11-15, 13:42)ksooo Wrote: To me what you describe reads like a bug, because for other addons like pvr.hts this works. 

Are you saying that the TVHeadend addon automatically updates the LiveTV & PVR channels, groups, epg etc. when it get these updates from the backend ?
Reply
#8
(2024-11-15, 14:08)taylormia Wrote:
(2024-11-15, 13:42)ksooo Wrote: To me what you describe reads like a bug, because for other addons like pvr.hts this works. 

Are you saying that the TVHeadend addon automatically updates the LiveTV & PVR channels, groups, epg etc. when it get these updates from the backend ?
Yes, exactly.
Reply
#9
>1. The NextPVR addon is disabled and re-enabled
> 2. Kodi is restarted
> 3. "Clear Data" is invoked in PVR & LiveTV

All of these "solutions" are at best workarounds, not fixing the root cause pvr.nextpvr not triggering data updates when something relevant in the backend changes. Not saying this is easy to fix, but still, an addon issue at the end.
Reply
#10
Thanks for the clarification. I'm hoping that the NextPVR addon fixes this issue.
Reply
#11
Sorry guys I missed some posts made while I posted 

@ksooo when the EPG update is detected the EPG update happens her https://github.com/kodi-pvr/pvr.nextpvr/...r.cpp#L336  but it doesn't refresh the channel list first.  If I make a change to detect and if necessary trigger a channel list and  channel group change, (no backend notifcation event for that  either) and then the EPG triggers are all these triggers processed synchronously by core?

Martin
Reply
#12
(2024-11-15, 15:26)emveepee Wrote: Sorry guys I missed some posts made while I posted 

@ksooo when the EPG update is detected the EPG update happens her https://github.com/kodi-pvr/pvr.nextpvr/...r.cpp#L336  but it doesn't refresh the channel list first.  If I make a change to detect and if necessary trigger a channel list and  channel group change, (no backend notifcation event for that  either) and then the EPG triggers are all these triggers processed synchronously by core?

Martin
You mean in same sequence, not really synchronously, right?

Update requests from Kodi are done in the order of your "Trigger*Update" calls, but not synchronously.
Exception is EPG which also keeps order of TriggerEpgUpdate calls, but I just found out that EPG uses internally a different queue for update requests, which is not synced with channel/groups/timers/recordings update requests. Maybe this is something that should be changed.
Reply
#13
I was wondering if triggers were synchronous which would case a problem, they need to be in sequence so EPG updates don't start until the channel list is loaded.  I could hold off the group update until the end.

There is a slight nuance since a user or user script could trigger additional EPG updates before this process has completed.
Reply
#14
(2024-11-15, 15:55)emveepee Wrote: I was wondering if triggers were synchronous which would case a problem, they need to be in sequence so EPG updates don't start until the channel list is loaded.  I could hold off the group update until the end.

There is a slight nuance since a user or user script could trigger additional EPG updates before this process has completed.

I'd say give it a try and change pvr.nextpvr accordingly and report back if you encounter any problems or need assistance. You know how to contact me. ;-)
Reply
#15
(2024-11-15, 15:09)taylormia Wrote: Thanks for the clarification. I'm hoping that the NextPVR addon fixes this issue.

Welcome to the development process.  Normally being open source I would invite you to submit a PR to address this but instead I will ask you to participate in the testing. Changing channels list and updating EPG's is time consuming and since this has not been a major issue, users have been happy to exit and reset the PVR database when absolutely necessary, I will only do basic testing.

I will not release this change without significant testing and feedback from you.  It will also only be in the Piers branch.  Here is the PR https://github.com/kodi-pvr/pvr.nextpvr/pull/275  where you need to provide link to logs and any problem reporting that you may have.  This thread can be closed as we can now discuss it on GitHub.  The logs need to be Kodi debug logs which will show the triggers are happening in sequence (or not).  You also need to follow Kodi rules on the debug log content.

Here are the compiled binaries https://jenkins.kodi.tv/blue/organizatio.../artifacts for many platforms.  Feel free to compile your own changes and make suggestions to the base PR.  It has not passed review by Kodi Team either so there may be other changes
Reply

Logout Mark Read Team Forum Stats Members Help
PVR "Clear Data" via API or Programmatically0