diff --git a/src/webui/extjs.c b/src/webui/extjs.c index f6c73a75..a795f955 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -545,7 +545,6 @@ extjs_epggrab(http_connection_t *hc, const char *remain, void *opaque) return HTTP_STATUS_BAD_REQUEST; } - htsmsg_print(out); htsmsg_json_serialize(out, hq, 0); htsmsg_destroy(out); http_output_content(hc, "text/x-json; charset=UTF-8"); @@ -829,6 +828,34 @@ extjs_epgrelated(http_connection_t *hc, const char *remain, void *opaque) return 0; } +static int +extjs_epgobject(http_connection_t *hc, const char *remain, void *opaque) +{ + htsbuf_queue_t *hq = &hc->hc_reply; + const char *op = http_arg_get(&hc->hc_req_args, "op"); + htsmsg_t *out, *array; + + if(op == NULL) + return 400; + + if (!strcmp(op, "brandList")) { + out = htsmsg_create_map(); + pthread_mutex_lock(&global_lock); + array = epg_brand_list(); + pthread_mutex_unlock(&global_lock); + htsmsg_add_msg(out, "entries", array); + + } else { + return HTTP_STATUS_BAD_REQUEST; + } + + htsmsg_json_serialize(out, hq, 0); + htsmsg_destroy(out); + http_output_content(hc, "text/x-json; charset=UTF-8"); + + return 0; +} + /** * */ @@ -1628,6 +1655,7 @@ extjs_start(void) http_path_add("/confignames", NULL, extjs_confignames, ACCESS_WEB_INTERFACE); http_path_add("/epg", NULL, extjs_epg, ACCESS_WEB_INTERFACE); http_path_add("/epgrelated", NULL, extjs_epgrelated, ACCESS_WEB_INTERFACE); + http_path_add("/epgobject", NULL, extjs_epgobject, ACCESS_WEB_INTERFACE); http_path_add("/dvr", NULL, extjs_dvr, ACCESS_WEB_INTERFACE); http_path_add("/dvrlist", NULL, extjs_dvrlist, ACCESS_WEB_INTERFACE); http_path_add("/ecglist", NULL, extjs_ecglist, ACCESS_WEB_INTERFACE); diff --git a/src/webui/static/app/dvr.js b/src/webui/static/app/dvr.js index 74de7cf2..0647ba41 100644 --- a/src/webui/static/app/dvr.js +++ b/src/webui/static/app/dvr.js @@ -446,6 +446,19 @@ tvheadend.autoreceditor = function() { emptyText: 'Only include channel...' }) },{ + header : "Brand", + dataIndex: 'brand', + editor : new Ext.form.ComboBox({ + loadingText: 'Loading...', + displayField: 'title', + valueField: 'uri', + store: tvheadend.brands, + mode: 'local', + editable: false, + triggerAction: 'all', + emptyText: 'Record brand...' + }) + },{ header: "Channel tag", dataIndex: 'tag', editor: new Ext.form.ComboBox({ @@ -622,7 +635,7 @@ tvheadend.dvr = function() { tvheadend.autorecRecord = Ext.data.Record.create([ - 'enabled','title','channel','tag','creator','contentgrp','comment', + 'enabled','title', 'brand', 'channel','tag','creator','contentgrp','comment', 'weekdays', 'pri', 'approx_time', 'config_name' ]); diff --git a/src/webui/static/app/epg.js b/src/webui/static/app/epg.js index 2c8e5e8c..be30ccf6 100644 --- a/src/webui/static/app/epg.js +++ b/src/webui/static/app/epg.js @@ -1,3 +1,13 @@ +tvheadend.brands = new Ext.data.JsonStore({ + root: 'entries', + // TODO: this is not ALL fields, just those that I'm likely to use here + fields: [ 'uri', 'title' ], + autoLoad: true, + url : 'epgobject', + baseParams : { op : 'brandList' } +}); +// TODO: we might want this to periodically update! + tvheadend.ContentGroupStore = new Ext.data.JsonStore({ root:'entries', fields: [{name: 'name'}],