// Note: sets updated
_epg_object_getref(ret);
- /* No change */
- } else if ( ret->stop == (*bcast)->stop ) {
- return ret;
-
- /* Extend in time */
+ /* Existing */
} else {
- ret->stop = (*bcast)->stop;
- _epg_object_set_updated(ret);
+ *save |= _epg_object_set_u16(ret, &ret->dvb_eid, (*bcast)->dvb_eid, NULL);
+
+ /* No time change */
+ if ( ret->stop == (*bcast)->stop ) {
+ return ret;
+
+ /* Extend in time */
+ } else {
+ ret->stop = (*bcast)->stop;
+ _epg_object_set_updated(ret);
+ }
}
}
ebc = _epg_broadcast_skel();
(*ebc)->start = start;
(*ebc)->stop = stop;
+ (*ebc)->dvb_eid = eid;
return _epg_channel_add_broadcast(channel, ebc, create, save);
}
return (epg_broadcast_t*)_epg_object_find_by_id(id, EPG_BROADCAST);
}
-epg_broadcast_t *epg_broadcast_find_by_eid ( channel_t *ch, int eid )
+epg_broadcast_t *epg_broadcast_find_by_eid ( channel_t *ch, uint16_t eid )
{
epg_broadcast_t *e;
RB_FOREACH(e, &ch->ch_epg_schedule, sched_link) {
{
epg_object_t; ///< Parent object
- int dvb_eid; ///< DVB Event ID
+ uint16_t dvb_eid; ///< DVB Event ID
time_t start; ///< Start time
time_t stop; ///< End time
epg_broadcast_t *epg_broadcast_find_by_time
( struct channel *ch, time_t start, time_t stop,
uint16_t eid, int create, int *save );
-epg_broadcast_t *epg_broadcast_find_by_eid ( struct channel *ch, int eid );
+epg_broadcast_t *epg_broadcast_find_by_eid ( struct channel *ch, uint16_t eid );
epg_broadcast_t *epg_broadcast_find_by_id ( uint64_t id, struct channel *ch );
/* Mutators */
1, &save);
/* Store */
- } else {
+ } else if (!(ebc = epg_broadcast_find_by_eid(ec->channel, ev.eid))) {
opentv_event_t *skel = malloc(sizeof(opentv_event_t));
memcpy(skel, &ev, sizeof(opentv_event_t));
assert(!RB_INSERT_SORTED(&sta->events, skel, ev_link, _ev_cmp));