Updated various EPG calls to the new API.

This commit is contained in:
Adam Sutton 2012-05-25 09:55:55 +01:00
parent b7575b18e5
commit cd3482dc06
6 changed files with 17 additions and 16 deletions

View file

@ -182,7 +182,7 @@ channel_create(const char *name, int number)
assert(x == NULL);
epg_add_channel(ch);
epg_channel_map_add(ch);
htsp_channel_add(ch);
return ch;
@ -249,7 +249,7 @@ channel_load_one(htsmsg_t *c, int id)
channel_set_name(ch, name);
epg_add_channel(ch);
epg_channel_map_add(ch);
tvh_str_update(&ch->ch_icon, htsmsg_get_str(c, "icon"));
@ -339,7 +339,7 @@ channel_rename(channel_t *ch, const char *newname)
RB_REMOVE(&channel_name_tree, ch, ch_name_link);
channel_set_name(ch, newname);
epg_mod_channel(ch);
epg_channel_map_mod(ch);
LIST_FOREACH(t, &ch->ch_services, s_ch_link)
t->s_config_save(t);
@ -379,7 +379,7 @@ channel_delete(channel_t *ch)
s->ths_channel = NULL;
}
epg_rem_channel(ch);
epg_channel_map_rem(ch);
hts_settings_remove("channels/%d", ch->ch_id);
@ -492,6 +492,7 @@ channel_set_epg_source(channel_t *ch, epg_channel_t *ec)
return;
ch->ch_epg_channel = ec;
// TODO: should I do this?
htsp_channel_update(ch); // Not sure?
}

View file

@ -185,14 +185,14 @@ static int _pyepg_parse_episode ( htsmsg_t *data, epggrab_stats_t *stats )
/* Set brand */
if ((str = htsmsg_get_str(attr, "brand"))) {
if ((brand = epg_brand_find_by_uri(str, 0, NULL))) {
save |= epg_episode_set_brand(episode, brand, 1);
save |= epg_episode_set_brand(episode, brand);
}
}
/* Set season */
if ((str = htsmsg_get_str(attr, "series"))) {
if ((season = epg_season_find_by_uri(str, 0, NULL))) {
save |= epg_episode_set_season(episode, season, 1);
save |= epg_episode_set_season(episode, season);
}
}
@ -254,9 +254,6 @@ static int _pyepg_parse_broadcast
if (!_pyepg_parse_time(start, &tm_start)) return 0;
if (!_pyepg_parse_time(stop, &tm_stop)) return 0;
/* Ignore */
if(tm_stop <= tm_start || tm_stop < dispatch_clock) return 0;
/* Find broadcast */
broadcast = epg_broadcast_find_by_time(channel, tm_start, tm_stop, 1, &save);
if ( broadcast == NULL ) return 0;
@ -264,7 +261,7 @@ static int _pyepg_parse_broadcast
if ( save ) stats->broadcasts.created++;
/* Set episode */
save |= epg_broadcast_set_episode(broadcast, episode, 1);
save |= epg_broadcast_set_episode(broadcast, episode);
/* TODO: extra metadata */
@ -383,8 +380,11 @@ static htsmsg_t* _pyepg_grab ( const char *iopts )
tvhlog(LOG_DEBUG, "pyepg", "grab %s %s", argv[0], iopts ? iopts : "");
/* Grab */
// TODO: HACK: use static input
#if 0
outlen = spawn_and_store_stdout(argv[0], (char *const*)argv, &outbuf);
#else
outlen = spawn_and_store_stdout("/home/aps/tmp/epg.sh", NULL, &outbuf);
#endif
free(opts);
if ( outlen < 1 ) {
tvhlog(LOG_ERR, "pyepg", "no output detected");

View file

@ -269,7 +269,7 @@ _xmltv_parse_programme_tags(epg_channel_t *xc, htsmsg_t *tags,
if ( ebc != NULL ) {
stats->broadcasts.total++;
if (save2) stats->broadcasts.created++;
save2 |= epg_broadcast_set_episode(ebc, ee, 1);
save2 |= epg_broadcast_set_episode(ebc, ee);
if (save2) stats->broadcasts.modified++;
}

View file

@ -808,7 +808,7 @@ htsp_method_getEvents(htsp_connection_t *htsp, htsmsg_t *in)
if(htsmsg_get_u32(in, "numFollowing", &numFollowing))
return htsp_error("Missing argument 'numFollowing'");
if((e = epg_broadcast_find_by_id(eventid)) == NULL) {
if((e = epg_broadcast_find_by_id(eventid, NULL)) == NULL) {
return htsp_error("Event does not exist");
}
@ -841,7 +841,7 @@ htsp_method_getEvent(htsp_connection_t *htsp, htsmsg_t *in)
if(htsmsg_get_u32(in, "eventId", &eventid))
return htsp_error("Missing argument 'eventId'");
if((e = epg_broadcast_find_by_id(eventid)) == NULL)
if((e = epg_broadcast_find_by_id(eventid, NULL)) == NULL)
return htsp_error("Event does not exist");
out = htsp_build_event(e);

View file

@ -793,7 +793,7 @@ extjs_epgrelated(http_connection_t *hc, const char *remain, void *opaque)
pthread_mutex_lock(&global_lock);
if ( id && type ) {
e = epg_broadcast_find_by_id(atoi(id));
e = epg_broadcast_find_by_id(atoi(id), NULL);
if ( e && e->episode ) {
ee = e->episode;

View file

@ -204,7 +204,7 @@ page_einfo(http_connection_t *hc, const char *remain, void *opaque)
pthread_mutex_lock(&global_lock);
if(remain == NULL || (e = epg_broadcast_find_by_id(atoi(remain))) == NULL) {
if(remain == NULL || (e = epg_broadcast_find_by_id(atoi(remain), NULL)) == NULL) {
pthread_mutex_unlock(&global_lock);
return 404;
}