pthread_cond_t epggrab_cond;
/* Config */
-uint32_t epggrab_eitenabled;
uint32_t epggrab_interval;
epggrab_module_t* epggrab_module;
epggrab_module_list_t epggrab_modules;
/* Process */
if (m) {
- htsmsg_get_u32(m, "eit", &epggrab_eitenabled);
if (!htsmsg_get_u32(m, old ? "grab-interval" : "interval", &epggrab_interval))
if (old) epggrab_interval *= 3600;
htsmsg_get_u32(m, "grab-enabled", &enabled);
/* Save */
m = htsmsg_create_map();
- htsmsg_add_u32(m, "eitenabled", epggrab_eitenabled);
htsmsg_add_u32(m, "interval", epggrab_interval);
if ( epggrab_module )
htsmsg_add_str(m, "module", epggrab_module->id);
htsmsg_destroy(m);
}
-int epggrab_set_eitenabled ( uint32_t eitenabled )
-{
- // TODO: could use module variable
- int save = 0;
- if ( epggrab_eitenabled != eitenabled ) {
- save = 1;
- epggrab_eitenabled = eitenabled;
- }
- return save;
-}
-
int epggrab_set_interval ( uint32_t interval )
{
int save = 0;
void epggrab_init ( void )
{
/* Defaults */
- epggrab_eitenabled = 1; // on air grab enabled
epggrab_interval = 12 * 3600; // hours
epggrab_module = NULL; // disabled
#include "epg.h"
#include "epggrab/eit.h"
+static epggrab_module_t _eit_mod;
+
/* ************************************************************************
- * Module Setup
+ * Processing
* ***********************************************************************/
static const char *
const char *description = NULL;
char *uri;
+ /* Disabled? */
+ if (!_eit_mod.enabled) return;
+
/* Ignore */
if (!ch || !ch->ch_name || !ch->ch_name[0]) return;
if (!title) return;
- /* Disabled? */
- if (!epggrab_eitenabled) return;
-
/* Find broadcast */
ebc = epg_broadcast_find_by_time(ch, start, stop, 1, &save);
if (!ebc) return;
* Module Setup
* ***********************************************************************/
-static epggrab_module_t _eit_mod;
-
void eit_init ( epggrab_module_list_t *list )
{
_eit_mod.id = strdup("eit");
_eit_mod.name = strdup("EIT: On-Air Grabber");
- *((uint8_t*)&_eit_mod.flags) = EPGGRAB_MODULE_SPECIAL;
+ *((uint8_t*)&_eit_mod.flags) = EPGGRAB_MODULE_OTA;
LIST_INSERT_HEAD(list, &_eit_mod, link);
// Note: this is mostly ignored anyway as EIT is treated as a special case!
}
/*
* Module lists (I'm sure there is a better way!)
*/
- var EPGGRAB_MODULE_SIMPLE = 0x01;
+ var EPGGRAB_MODULE_INTERNAL = 0x01;
var EPGGRAB_MODULE_EXTERNAL = 0x02;
+ var EPGGRAB_MODULE_OTA = 0x04;
var moduleStore = new Ext.data.JsonStore({
root : 'entries',
autoLoad : true,
fields : [ 'id', 'name', 'path', 'flags', 'enabled' ]
});
- var simpleModuleStore = new Ext.data.Store({
+ var internalModuleStore = new Ext.data.Store({
recordType: moduleStore.recordType
});
var externalModuleStore = new Ext.data.Store({
recordType: moduleStore.recordType
});
+ var otaModuleStore = new Ext.data.Store({
+ recordType: moduleStore.recordType
+ });
moduleStore.on('load', function() {
moduleStore.filterBy(function(r) {
- return r.get('flags') & EPGGRAB_MODULE_SIMPLE;
+ return r.get('flags') & EPGGRAB_MODULE_INTERNAL;
});
- r = new simpleModuleStore.recordType({ id: '', name : 'Disabled'});
- simpleModuleStore.add(r);
+ r = new internalModuleStore.recordType({ id: '', name : 'Disabled'});
+ internalModuleStore.add(r);
moduleStore.each(function(r) {
- simpleModuleStore.add(r.copy());
+ internalModuleStore.add(r.copy());
});
moduleStore.filterBy(function(r) {
return r.get('flags') & EPGGRAB_MODULE_EXTERNAL;
moduleStore.each(function(r) {
externalModuleStore.add(r.copy());
});
+ moduleStore.filterBy(function(r) {
+ return r.get('flags') & EPGGRAB_MODULE_OTA;
+ });
+ moduleStore.each(function(r) {
+ otaModuleStore.add(r.copy());
+ });
});
/*
var confreader = new Ext.data.JsonReader(
{ root: 'epggrabSettings' },
- [ 'module', 'eitenabled', 'advanced', 'interval' ]
+ [ 'module', 'interval' ]
);
/* ****************************************************************
/*
* Module selector
*/
- var simpleModule = new Ext.form.ComboBox({
+ var internalModule = new Ext.form.ComboBox({
fieldLabel : 'Module',
hiddenName : 'module',
width : 300,
editable : false,
mode : 'local',
triggerAction : 'all',
- store : simpleModuleStore
+ store : internalModuleStore
});
/*
},
iconCls : 'icon-grid',
});
- var advancedPanel = externalGrid;
+
+ /*
+ * OTA modules
+ */
+
+ var otaSelectionModel = new Ext.grid.CheckboxSelectionModel({
+ singleSelect : false,
+ listeners : {
+ 'rowselect' : function (s, ri, r) {
+ r.set('enabled', 1);
+ },
+ 'rowdeselect' : function (s, ri, r) {
+ r.set('enabled', 0);
+ }
+ }
+ });
+
+ var otaGrid = new Ext.grid.EditorGridPanel({
+ store : otaModuleStore,
+ cm : externalColumnModel,
+ sm : otaSelectionModel,
+ width : 600,
+ height : 150,
+ frame : false,
+ viewConfig : {
+ forceFit : true,
+ },
+ iconCls : 'icon-grid',
+ });
+
+ /* HACK: get display working */
externalGrid.on('render', function(){
- // TODO: bit of hack to get selection working
delay = new Ext.util.DelayedTask(function(){
rows = [];
externalModuleStore.each(function(r){
});
delay.delay(100);
});
+ otaGrid.on('render', function(){
+ delay = new Ext.util.DelayedTask(function(){
+ rows = [];
+ otaModuleStore.each(function(r){
+ if (r.get('enabled')) rows.push(r);
+ });
+ otaSelectionModel.selectRecords(rows);
+ });
+ delay.delay(100);
+ });
/* ****************************************************************
* Form
* ***************************************************************/
- var eitCheck = new Ext.form.Checkbox({
- fieldLabel : 'EIT Enabled',
- name : 'eitenabled'
- });
-
var saveButton = new Ext.Button({
text : "Save configuration",
tooltip : 'Save changes made to configuration below',
defaultType : 'textfield',
items : [
interval,
- eitCheck,
- simpleModule,
+ internalModule,
intervalValue,
intervalUnit,
new Ext.form.Label({text: 'External Interfaces'}),
- advancedPanel
+ externalGrid,
+ new Ext.form.Label({text: 'OTA Modules'}),
+ otaGrid,
],
tbar: [
saveButton,
externalModuleStore.each(function(r) {
mods.push({id: r.get('id'), enabled: r.get('enabled') ? 1 : 0});
});
+ otaModuleStore.each(function(r) {
+ mods.push({id: r.get('id'), enabled: r.get('enabled') ? 1 : 0});
+ });
mods = Ext.util.JSON.encode(mods);
confpanel.getForm().submit({
url : 'epggrab',
return confpanel;
}
-