epggrab_module_channel_save(ec->mod, ec);
}
+// TODO: currently lists ALL channels from ALL active modules
+// TODO: won't work if channels are handled internally within module!
+htsmsg_t *epggrab_channel_list ( void )
+{
+ char name[100];
+ epggrab_module_t *mod;
+ epggrab_channel_t *ec;
+ htsmsg_t *e, *m;
+ m = htsmsg_create_list();
+ LIST_FOREACH(mod, &epggrab_modules, link) {
+ if (mod->enabled && mod->channels) {
+ RB_FOREACH(ec, mod->channels, link) {
+ e = htsmsg_create_map();
+ htsmsg_add_str(e, "module", mod->id);
+ htsmsg_add_str(e, "id", ec->id);
+ sprintf(name, "%s: %s", mod->name, ec->name);
+ htsmsg_add_str(e, "name", name);
+ htsmsg_add_msg(m, NULL, e);
+ }
+ }
+ }
+ return m;
+}
+
/* **************************************************************************
* Configuration
* *************************************************************************/
{
int save = 0;
if ( epggrab_module != mod ) {
+ if (epggrab_module) epggrab_enable_module(epggrab_module, 0);
if (mod) {
assert(mod->grab);
assert(mod->trans);
assert(mod->parse);
}
epggrab_module = mod;
+ if (epggrab_module) epggrab_enable_module(epggrab_module, 1);
save = 1;
}
return save;
#include "epggrab.h"
#include "epg.h"
#include "iptv_input.h"
-#include "epggrab/xmltv.h"
static void
extjs_load(htsbuf_queue_t *hq, const char *script)
pthread_mutex_unlock(&epggrab_mutex);
htsmsg_add_msg(out, "entries", array);
+ /* Channel list */
+ } else if (!strcmp(op, "channelList")) {
+ out = htsmsg_create_map();
+ pthread_mutex_lock(&global_lock);
+ array = epggrab_channel_list();
+ pthread_mutex_unlock(&global_lock);
+ htsmsg_add_msg(out, "entries", array);
+
/* Save settings */
} else if (!strcmp(op, "saveSettings") ) {
int save = 0;
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");
+++ /dev/null
-tvheadend.grabberStore = new Ext.data.JsonStore({
- root:'entries',
- fields: ['identifier','name','version','apiconfig'],
- url:'xmltv',
- baseParams: {
- op: 'listGrabbers'
- }
-});
-
-tvheadend.xmltv = function() {
-
- var confreader = new Ext.data.JsonReader({
- root: 'xmltvSettings'
- }, ['grabber','grabinterval','grabenable']);
-
- var grabberSelect = new Ext.form.ComboBox({
- loadingText: 'Loading, please wait...',
- fieldLabel: 'XML-TV Source',
- name: 'grabber',
- width: 350,
- displayField:'name',
- valueField:'identifier',
- store: tvheadend.grabberStore,
- forceSelection: true,
- editable: false,
- triggerAction: 'all',
- mode: 'remote',
- emptyText: 'Select grabber'
- });
-
- var confpanel = new Ext.FormPanel({
- title:'XML TV',
- iconCls: 'xml',
- border:false,
- bodyStyle:'padding:15px',
- labelAlign: 'right',
- labelWidth: 200,
- waitMsgTarget: true,
- reader: confreader,
- layout: 'form',
- defaultType: 'textfield',
- items: [
- grabberSelect,
- new Ext.form.NumberField({
- allowNegative: false,
- allowDecimals: false,
- minValue: 1,
- maxValue: 100,
- fieldLabel: 'Grab interval (hours)',
- name: 'grabinterval'
- }), new Ext.form.Checkbox({
- fieldLabel: 'Enable grabbing',
- name: 'grabenable'
- })
- ],
- tbar: [{
- tooltip: 'Save changes made to configuration below',
- iconCls:'save',
- text: "Save configuration",
- handler: saveChanges
- }, '->', {
- text: 'Help',
- handler: function() {
- new tvheadend.help('XMLTV configuration',
- 'config_xmltv.html');
- }
- }]
-
- });
-
- confpanel.on('render', function() {
- confpanel.getForm().load({
- url:'xmltv',
- params:{'op':'loadSettings'},
- success:function(form, action) {
- confpanel.enable();
- }
- });
- });
-
-
- grabberSelect.on('select', function(c,r,i) {
-
- Ext.MessageBox.alert('XMLTV',
- 'Make sure that the grabber is properly ' +
- 'configured before saving configuration.<br>'+
- '<br>' +
- 'To configure manually execute the ' +
- 'following command in a shell on the ' +
- 'server:<br>' +
- '$ ' + r.data.identifier +
- ' --configure<br>' +
- '<br>' +
- 'Note: It is important to configure the ' +
- 'grabber using the same userid as tvheadend '+
- 'since most grabbers save their '+
- 'configuration in the users home directory.'+
- '<br>' +
- '<br>' +
- 'Grabber version: ' + r.data.version
- );
-
-/*
- if(r.data.apiconfig) {
-
- Ext.MessageBox.confirm('XMLTV',
- 'Configure grabber? ' +
- 'If you know that the grabber is already '+
- 'set up or if you want to configure it '+
- 'manually you may skip this step',
- function(button) {
- Ext.MessageBox.alert('XMLTV',
- 'oops, embedded '+
- 'config not '+
- 'implemeted yet');
- }
- );
-
- } else {
- Ext.MessageBox.alert('XMLTV',
- 'This grabber does not support being ' +
- 'configured from external application ' +
- '(such as Tvheadend).<br>' +
- 'Make sure that the grabber is properly ' +
- 'configured before saving configuration.<br>'+
- '<br>' +
- 'To configure manually execute the ' +
- 'following command in a shell on the ' +
- 'server:<br>' +
- '$ ' + r.data.identifier +
- ' --configure<br>' +
- '<br>' +
- 'Note: It is important to configure the ' +
- 'grabber using the same userid as tvheadend '+
- 'since most grabbers save their '+
- 'configuration in the users home directory.'+
- '<br>' +
- '<br>' +
- 'Grabber version: ' + r.data.version
- );
- }
-*/
- });
-
- function saveChanges() {
- confpanel.getForm().submit({
- url:'xmltv',
- params:{'op':'saveSettings'},
- waitMsg:'Saving Data...',
- failure: function(form, action) {
- Ext.Msg.alert('Save failed', action.result.errormsg);
- }
- });
- }
-
- return confpanel;
-}
-