From 70d013295ba422958083ae0657be478908fb42c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Wed, 24 Sep 2008 17:02:21 +0000 Subject: [PATCH] Add content group and comment to auto recording. --- dvr/dvr_autorec.c | 29 +++++++++++++++++++++-------- webui/static/app/dvr.js | 24 +++++++++++++++++++----- webui/static/app/epg.js | 17 +++++++++-------- 3 files changed, 49 insertions(+), 21 deletions(-) diff --git a/dvr/dvr_autorec.c b/dvr/dvr_autorec.c index f1cce683..475874e9 100644 --- a/dvr/dvr_autorec.c +++ b/dvr/dvr_autorec.c @@ -42,6 +42,7 @@ typedef struct dvr_autorec_entry { int dae_enabled; char *dae_creator; + char *dae_comment; char *dae_title; regex_t dae_title_preg; @@ -139,6 +140,7 @@ autorec_entry_destroy(dvr_autorec_entry_t *dae) free(dae->dae_id); free(dae->dae_creator); + free(dae->dae_comment); if(dae->dae_title != NULL) { free(dae->dae_title); @@ -166,13 +168,20 @@ autorec_record_build(dvr_autorec_entry_t *dae) htsmsg_add_str(e, "id", dae->dae_id); htsmsg_add_u32(e, "enabled", !!dae->dae_enabled); - htsmsg_add_str(e, "creator", dae->dae_creator ?: ""); - if(dae->dae_channel) - htsmsg_add_str(e, "channel", - dae->dae_channel ? dae->dae_channel->ch_name : ""); - if(dae->dae_channel_tag) - htsmsg_add_str(e, "channeltag", - dae->dae_channel_tag ? dae->dae_channel_tag->ct_name : ""); + + if(dae->dae_creator != NULL) + htsmsg_add_str(e, "creator", dae->dae_creator); + if(dae->dae_comment != NULL) + htsmsg_add_str(e, "comment", dae->dae_comment); + + htsmsg_add_str(e, "channel", + dae->dae_channel ? dae->dae_channel->ch_name : ""); + htsmsg_add_str(e, "tag", + dae->dae_channel_tag ? dae->dae_channel_tag->ct_name : ""); + + htsmsg_add_str(e, "contentgrp", + dae->dae_ecg ? dae->dae_ecg->ecg_name : ""); + htsmsg_add_str(e, "title", dae->dae_title ?: ""); return e; @@ -233,6 +242,7 @@ autorec_record_update(void *opaque, const char *id, htsmsg_t *values, return NULL; tvh_str_set(&dae->dae_creator, htsmsg_get_str(values, "creator")); + tvh_str_set(&dae->dae_comment, htsmsg_get_str(values, "comment")); if((s = htsmsg_get_str(values, "channel")) != NULL) { if(dae->dae_channel != NULL) { @@ -258,7 +268,7 @@ autorec_record_update(void *opaque, const char *id, htsmsg_t *values, } } - if((s = htsmsg_get_str(values, "channeltag")) != NULL) { + if((s = htsmsg_get_str(values, "tag")) != NULL) { if(dae->dae_channel_tag != NULL) { LIST_REMOVE(dae, dae_channel_tag_link); dae->dae_channel_tag = NULL; @@ -269,6 +279,9 @@ autorec_record_update(void *opaque, const char *id, htsmsg_t *values, } } + if((s = htsmsg_get_str(values, "contentgrp")) != NULL) + dae->dae_ecg = epg_content_group_find_by_name(s); + return autorec_record_build(dae); } diff --git a/webui/static/app/dvr.js b/webui/static/app/dvr.js index 7f2ca791..fbe21c7f 100644 --- a/webui/static/app/dvr.js +++ b/webui/static/app/dvr.js @@ -194,7 +194,7 @@ tvheadend.autoreceditor = function() { var enabledColumn = new Ext.grid.CheckColumn({ header: "Enabled", dataIndex: 'enabled', - width: 60 + width: 30 }); var cm = new Ext.grid.ColumnModel([ @@ -202,14 +202,12 @@ tvheadend.autoreceditor = function() { { header: "Title (Regexp)", dataIndex: 'title', - width: 200, editor: new fm.TextField({allowBlank: true}) },{ header: "Channel", dataIndex: 'channel', editor: new Ext.form.ComboBox({ loadingText: 'Loading...', - width: 200, displayField:'name', store: tvheadend.channels, mode: 'local', @@ -219,7 +217,7 @@ tvheadend.autoreceditor = function() { }) },{ header: "Channel tag", - dataIndex: 'channeltag', + dataIndex: 'tag', editor: new Ext.form.ComboBox({ displayField:'name', store: tvheadend.channelTags, @@ -228,15 +226,31 @@ tvheadend.autoreceditor = function() { triggerAction: 'all', emptyText: 'Only include tag...' }) + },{ + header: "Content Group", + dataIndex: 'contentgrp', + editor: new Ext.form.ComboBox({ + displayField:'name', + store: tvheadend.ContentGroupStore, + mode: 'local', + editable: false, + triggerAction: 'all', + emptyText: 'Only include content...' + }) + },{ header: "Creator", dataIndex: 'creator', editor: new fm.TextField({allowBlank: false}) + },{ + header: "Comment", + dataIndex: 'comment', + editor: new fm.TextField({allowBlank: false}) } ]); var rec = Ext.data.Record.create([ - 'enabled','title','channel','channeltag','creator' + 'enabled','title','channel','tag','creator','contentgrp','comment' ]); return new tvheadend.tableEditor('Automatic Recorder', diff --git a/webui/static/app/epg.js b/webui/static/app/epg.js index dfefbfe4..df44953b 100644 --- a/webui/static/app/epg.js +++ b/webui/static/app/epg.js @@ -1,3 +1,10 @@ +tvheadend.ContentGroupStore = new Ext.data.JsonStore({ + root:'entries', + fields: [{name: 'name'}], + autoLoad: true, + url:'ecglist', +}); + tvheadend.epgDetails = function(event) { @@ -173,19 +180,13 @@ tvheadend.epg = function() { // Content groups - var epgFilterContentGroupStore = new Ext.data.JsonStore({ - root:'entries', - fields: [{name: 'name'}], - url:'ecglist', - }); - var epgFilterContentGroup = new Ext.form.ComboBox({ loadingText: 'Loading...', width: 200, displayField:'name', - store: epgFilterContentGroupStore, - mode: 'remote', + store: tvheadend.ContentGroupStore, + mode: 'local', editable: false, triggerAction: 'all', emptyText: 'Only include content...'