Bug EPG database not used
#1
I've just discovered that EPG database seems to be useless at least on loading PVR data on XBMC start.

For example, let's take a use case for one PVR client with one channel. The flow contains the following steps:
0. EPG DB is empty.
1. Load channel "Channel1" and its EPG from client.
2. Put the EPG to database. "epg" table contains now one record: "idEpg=1 name=Channel1" and "epgtags" contains records linked to idEpg=1.
3. CEpgContainer::m_epgs contains one item for idEpg=1.
4. Restart XBMC.
5. Load EPG from DB => CEpgContainer::m_epgs = {1: Channel1 EPG}.
6. Load EPG from client creates the new CEpg object with new idEpg=2.
7. Put EPG to database. "epg" tables contains two records: "idEpg=1 name=Channel1", "idEpg=2 name=Channel1", and in "epgtags" we have duplicate items for these EPGs.
8. CEpgContainer::m_epgs contains two items: CEpgContainer::m_epgs = {1: Channel1 EPG from DB, 2: Channel1 EPG from client}. The first one doesn't have CPVRChannel pointer and the second one used only.
9. Cleanup database => delete idEpg=1 and all linked records.
10. Restart XBMC.
11. Goto 5.

According to the flow the previous database entries for EPG are never used.

To fix this there must be a way to identify EPG for a channel. For example, adding clientId and channelId identifiers to "epg" table will do the thing.

Before creating the PR I'd like to know if this is a bug indeed or I'm missing something?
Reply
#2
Hey vkosh, I need some time to check this and let you know if you missing something or if this is a bug or could be improved.
Reply
#3
xhaggi, thanks in advance. I forgot to mention that the flow was tested on Gotham@head. And by "Cleanup database" in 9 I mean auto cleanup which may or may not occur between restart cycles.
Reply
#4
From what i've found I have this issue for some channels but not for all. It's hard to debug the code here.
The relation between a channel and the corresponding epg is stored in the TV database in table channels. There is a column idEPG.
So there is no need to add this in EPG database too.

However, I don't know why this happens for some channels.
Reply
#5
xhaggi, thanks for pointing out the way channel and epg related. I'll continue to find the issue when I have time.
Reply
#6
there's only a link from channel -> epg, not the other way around in the tables. the reason is that i had envisioned the epg code to be usable separated from pvr, so you could use the epg for non pvr related things too (think about an agenda, events nearby, etc.) but i've never finished this really. i do want to keep the two namespaces separated as much as possible though, in case i do want to finish that some day ;-)

create a ticket for this if there's no ticket for this yet please.
opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
Reply
#7
opdenkamp, thanks for the explanation. I created the ticket: http://trac.xbmc.org/ticket/14908
Reply

Logout Mark Read Team Forum Stats Members Help
EPG database not used0