diff --git a/src/epg.c b/src/epg.c
index 7fd851b9..054313f5 100644
--- a/src/epg.c
+++ b/src/epg.c
@@ -561,6 +561,8 @@ int epg_episode_get_number_onscreen
* Broadcast
* *************************************************************************/
+static int _epg_broadcast_idx = 0;
+
// Note: will find broadcast playing at this time (not necessarily
// one that starts at this time)
//
@@ -580,6 +582,7 @@ epg_broadcast_t* epg_broadcast_find_by_time
skel->eb_channel = channel;
skel->eb_start = start;
skel->eb_stop = stop;
+ skel->eb_id = _epg_broadcast_idx;
/* Find */
if ( !create ) {
@@ -591,12 +594,26 @@ epg_broadcast_t* epg_broadcast_find_by_time
if ( eb == NULL ) {
eb = skel;
skel = NULL;
+ _epg_broadcast_idx++;
}
}
return eb;
}
+epg_broadcast_t *epg_broadcast_find_by_id ( int id )
+{
+ // TODO: do this properly
+ epg_channel_t *ec;
+ epg_broadcast_t *ebc;
+ RB_FOREACH(ec, &epg_channels, ec_link) {
+ RB_FOREACH(ebc, &ec->ec_schedule, eb_slink) {
+ if (ebc->eb_id == id) return ebc;
+ }
+ }
+ return NULL;
+}
+
int epg_broadcast_set_episode
( epg_broadcast_t *broadcast, epg_episode_t *episode, int u )
{
diff --git a/src/epg.h b/src/epg.h
index fe64852c..3fcb71e5 100644
--- a/src/epg.h
+++ b/src/epg.h
@@ -217,6 +217,7 @@ typedef struct epg_broadcast
/* Lookup */
epg_broadcast_t *epg_broadcast_find_by_time ( epg_channel_t *ch, time_t start, time_t stop, int create );
+epg_broadcast_t *epg_broadcast_find_by_id ( int id );
/* Mutators */
int epg_broadcast_set_episode ( epg_broadcast_t *b, epg_episode_t *e, int u )
diff --git a/src/webui/simpleui.c b/src/webui/simpleui.c
index 44e1b56a..d4f34b8c 100644
--- a/src/webui/simpleui.c
+++ b/src/webui/simpleui.c
@@ -58,15 +58,14 @@ static int
page_simple(http_connection_t *hc,
const char *remain, void *opaque)
{
-#if TODO
htsbuf_queue_t *hq = &hc->hc_reply;
const char *s = http_arg_get(&hc->hc_req_args, "s");
- event_t *e;
+ epg_broadcast_t *e;
int c, k, i;
struct tm a, b, day;
dvr_entry_t *de;
dvr_query_result_t dqr;
- const char *rstatus;
+ const char *rstatus = NULL;
epg_query_result_t eqr;
htsbuf_qprintf(hq, "");
@@ -109,8 +108,8 @@ page_simple(http_connection_t *hc,
for(k = 0; k < c; k++) {
e = eqr.eqr_array[k];
- localtime_r(&e->e_start, &a);
- localtime_r(&e->e_stop, &b);
+ localtime_r(&e->eb_start, &a);
+ localtime_r(&e->eb_stop, &b);
if(a.tm_wday != day.tm_wday || a.tm_mday != day.tm_mday ||
a.tm_mon != day.tm_mon || a.tm_year != day.tm_year) {
@@ -120,16 +119,18 @@ page_simple(http_connection_t *hc,
days[day.tm_wday], day.tm_mday, day.tm_mon + 1);
}
+#if TODO_DVR
de = dvr_entry_find_by_event(e);
rstatus = de != NULL ? val2str(de->de_sched_state,
recstatustxt) : NULL;
+#endif
htsbuf_qprintf(hq,
""
"%02d:%02d-%02d:%02d %s%s%s
",
- e->e_id,
+ e->eb_id,
a.tm_hour, a.tm_min, b.tm_hour, b.tm_min,
- e->e_title,
+ e->eb_episode->ee_title,
rstatus ? " " : "", rstatus ?: "");
}
}
@@ -185,7 +186,6 @@ page_simple(http_connection_t *hc,
htsbuf_qprintf(hq, "