Minor fix to get htsp epg download working.

This commit is contained in:
Adam Sutton 2012-05-25 12:10:29 +01:00
parent e9a8ad5a48
commit f9333d0072
3 changed files with 9 additions and 41 deletions

View file

@ -1007,7 +1007,7 @@ int epg_broadcast_set_episode
epg_broadcast_t *epg_broadcast_get_next ( epg_broadcast_t *broadcast )
{
if ( !broadcast ) return NULL;
return RB_NEXT(broadcast, slink);
return (epg_broadcast_t*)RB_NEXT((epg_object_t*)broadcast, glink);
}
htsmsg_t *epg_broadcast_serialize ( epg_broadcast_t *broadcast )

View file

@ -235,7 +235,6 @@ typedef struct epg_broadcast
uint8_t is_new; ///< New series / file premiere
uint8_t is_repeat; ///< Repeat screening
RB_ENTRY(epg_broadcast) slink; ///< Schedule link
RB_ENTRY(epg_broadcast) elink; ///< Episode link
epg_episode_t *episode; ///< Episode shown
epg_channel_t *channel; ///< Channel being broadcast on
@ -344,6 +343,8 @@ void epg_updated (void);
* Compatibility code
* ***********************************************************************/
#ifndef TODO_REMOVE_EPG_COMPAT
typedef struct _epg_episode {
uint16_t ee_season;
@ -382,41 +383,5 @@ typedef struct event {
_epg_episode_t e_episode;
} event_t;
#if 0
void epg_event_updated(event_t *e);
event_t *epg_event_create(channel_t *ch, time_t start, time_t stop,
int dvb_id, int *created);
event_t *epg_event_find_by_time(channel_t *ch, time_t t);
event_t *epg_event_find_by_id(int eventid);
void epg_unlink_from_channel(channel_t *ch);
/**
*
*/
uint8_t epg_content_group_find_by_name(const char *name);
const char *epg_content_group_get_name(uint8_t type);
/**
*
*/
typedef struct epg_query_result {
event_t **eqr_array;
int eqr_entries;
int eqr_alloced;
} epg_query_result_t;
void epg_query0(epg_query_result_t *eqr, channel_t *ch, channel_tag_t *ct,
uint8_t type, const char *title);
void epg_query(epg_query_result_t *eqr, const char *channel, const char *tag,
const char *contentgroup, const char *title);
void epg_query_free(epg_query_result_t *eqr);
void epg_query_sort(epg_query_result_t *eqr);
#endif
#endif /* EPG_H */

View file

@ -298,6 +298,7 @@ htsp_build_channel(channel_t *ch, const char *method)
channel_tag_t *ct;
service_t *t;
epg_broadcast_t *now, *next = NULL;
printf("htsp_build_channel(%s)\n", ch->ch_name);
htsmsg_t *out = htsmsg_create_map();
htsmsg_t *tags = htsmsg_create_list();
@ -313,6 +314,7 @@ htsp_build_channel(channel_t *ch, const char *method)
if (ch->ch_epg_channel) {
now = ch->ch_epg_channel->now;
next = ch->ch_epg_channel->next;
printf(" now = %p, next = %p\n", now, next);
htsmsg_add_u32(out, "eventId", now ? now->_.id : 0);
htsmsg_add_u32(out, "nextEventId", next ? next->_.id : 0);
}
@ -753,13 +755,12 @@ htsp_build_event(epg_broadcast_t *e)
#if TODO_DVR
dvr_entry_t *de;
#endif
printf("htsp_build_event(%p, %lu)\n", e, e->_.id);
out = htsmsg_create_map();
htsmsg_add_u32(out, "eventId", e->_.id);
#if TODO_EPG_CHANNEL
htsmsg_add_u32(out, "channelId", e->e_channel->ch_id);
#endif
htsmsg_add_u32(out, "channelId", e->channel->channel->ch_id);
htsmsg_add_u32(out, "start", e->start);
htsmsg_add_u32(out, "stop", e->stop);
if(e->episode->title != NULL)
@ -809,6 +810,7 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
if(htsmsg_get_u32(in, "numFollowing", &numFollowing))
return htsp_error("Missing argument 'numFollowing'");
printf("htsp_method_getEvents(%d, %d)\n", eventid, numFollowing);
if((e = epg_broadcast_find_by_id(eventid, NULL)) == NULL) {
return htsp_error("Event does not exist");
@ -842,6 +844,7 @@ htsp_method_getEvent(htsp_connection_t *htsp, htsmsg_t *in)
if(htsmsg_get_u32(in, "eventId", &eventid))
return htsp_error("Missing argument 'eventId'");
printf("htsp_method_getEvent(%d)", eventid);
if((e = epg_broadcast_find_by_id(eventid, NULL)) == NULL)
return htsp_error("Event does not exist");