Is there any way to possibly make the MythTV PVR add-on retrieve EPG data from the backend faster? I tend to set it to only load a couple of days of EPG data but on start-up it seems to take a minute or so to load.
I see that Kodi's PVR interface seems to request this by making calls to GetEPGForChannel, specifying a channel and start/end time. However MythTV's GetProgramGuide API looks like it is capable of requesting information for multiple channels in one call.
This is really only an issue when Kodi is starting up (for some reason it never seems to store the EPG database regardless of whether I tell it to or not). If there's some way to check how many days of EPG Kodi wants, on startup the add-on could request all of the EPG data for all channels for that time period (so, basically pre-fetch it for Kodi's individual calls to GetEPGForChannel). Once Kodi has retrieved all the initial EPG data it wants (unsure how this would be determined - a period of EPG request inactivity?), just go back to the current behaviour.
It's a minor issue, just with the frequency which I have to restart Kodi (or it restarts itself), it can be quite frustrating to wait for it to finish populating the guide on start-up. I could remove some channels of course. I'd also like to have more days of EPG so loading it faster would be great.
I might try and have a look into how to do this once I get more familiar with how everything works.
There seems to be a side-effect of the slow EPG loading: Obviously, with debugging enabled (like I have now) it takes even longer (a couple of minutes perhaps?) so I've reduced the amount of data loaded to 1 day. However, on startup, Kodi restarts itself about 70% through loading the EPG data, repeatedly. I can prevent this by playing/stopping a channel every 20-25% until it finishes.
Whenever the restart happens I get a crash log showing an assertion relating to a mutex:
Thread 1 (Thread 0x60064370 (LWP 7816)):
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x74e46184 in __GI_abort () at abort.c:79
#2 0x74e532c8 in __assert_fail_base (fmt=0x74f4a298 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x76f72ef0 "INTERNAL_SYSCALL_ERRNO (e, __err) != EDEADLK || (kind != PTHREAD_MUTEX_ERRORCHECK_NP && kind != PTHREAD_MUTEX_RECURSI
VE_NP)", assertion@entry=0x60064370 "\001", file=0x76f73130 "pthread_mutex_lock.c", file@entry=0x76f73028 <PRETTY_FUNCTION.12300> "__pthread_mutex_lock_full", line=422, line@entry=1995911472, function=function@entry=0x76f73028 <PRE
TTY_FUNCTION.12300> "__pthread_mutex_lock_full") at assert.c:92
#3 0x74e53378 in __GI___assert_fail (assertion=0x60064370 "\001", file=0x76f73028 <PRETTY_FUNCTION.12300> "__pthread_mutex_lock_full", line=1995911472, line@entry=422, function=0x76f73028 <PRETTY_FUNCTION.12300> "__pthread_mutex
_lock_full") at assert.c:101
#4 0x76f67b6c in __pthread_mutex_lock_full (mutex=0x60064370) at pthread_mutex_lock.c:420
#5 0x009aa728 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
############# END STACK TRACE ###############
Of course, the above could just be Kodi not liking something else, but it doesn't happen once the EPG has finished loading so I wondered if it's timing out waiting for something and then deciding something's wrong so it needs to restart.