From cd3482dc06d4c32b11ab5aafc0c65c7d6ecba45f Mon Sep 17 00:00:00 2001 From: Adam Sutton Date: Fri, 25 May 2012 09:55:55 +0100 Subject: [PATCH] Updated various EPG calls to the new API. --- src/channels.c | 9 +++++---- src/epggrab/pyepg.c | 14 +++++++------- src/epggrab/xmltv.c | 2 +- src/htsp.c | 4 ++-- src/webui/extjs.c | 2 +- src/webui/simpleui.c | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/channels.c b/src/channels.c index f83c070d..76659115 100644 --- a/src/channels.c +++ b/src/channels.c @@ -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? } diff --git a/src/epggrab/pyepg.c b/src/epggrab/pyepg.c index 4ab41ca2..31de4c56 100644 --- a/src/epggrab/pyepg.c +++ b/src/epggrab/pyepg.c @@ -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"); diff --git a/src/epggrab/xmltv.c b/src/epggrab/xmltv.c index 00672453..7e7d0bca 100644 --- a/src/epggrab/xmltv.c +++ b/src/epggrab/xmltv.c @@ -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++; } diff --git a/src/htsp.c b/src/htsp.c index abfb147c..8660ee12 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -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); diff --git a/src/webui/extjs.c b/src/webui/extjs.c index a7116c59..f1b07f03 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -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; diff --git a/src/webui/simpleui.c b/src/webui/simpleui.c index d96b3f92..d43eadaa 100644 --- a/src/webui/simpleui.c +++ b/src/webui/simpleui.c @@ -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; }