return 0;
}
+static int
+api_epggrab_rerun_internal
+ ( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
+{
+ int32_t s32;
+ if (htsmsg_get_s32(args, "rerun", &s32))
+ return EINVAL;
+ if (s32 > 0) {
+ pthread_mutex_lock(&global_lock);
+ epggrab_rerun_internal();
+ pthread_mutex_unlock(&global_lock);
+ }
+ return 0;
+}
+
void api_epggrab_init ( void )
{
static api_hook_t ah[] = {
{ "epggrab/config/load", ACCESS_ADMIN, api_idnode_load_simple, &epggrab_conf.idnode },
{ "epggrab/config/save", ACCESS_ADMIN, api_idnode_save_simple, &epggrab_conf.idnode },
{ "epggrab/ota/trigger", ACCESS_ADMIN, api_epggrab_ota_trigger, NULL },
+ { "epggrab/internal/rerun", ACCESS_ADMIN, api_epggrab_rerun_internal, NULL },
{ NULL },
};
return NULL;
}
+void
+epggrab_rerun_internal(void)
+{
+ epggrab_confver++;
+ pthread_cond_signal(&epggrab_cond);
+}
+
/* **************************************************************************
* Configuration
* *************************************************************************/
epggrab_class_changed(idnode_t *self)
{
/* Register */
- epggrab_confver++;
- pthread_cond_signal(&epggrab_cond);
+ epggrab_rerun_internal();
}
static htsmsg_t *
int epggrab_activate_module ( epggrab_module_t *mod, int activate );
void epggrab_ota_set_cron ( void );
void epggrab_ota_trigger ( int secs );
+void epggrab_rerun_internal ( void );
/*
* Load/Save
+tvheadend.epggrab_rerun_button = function() {
+ return {
+ name: 'trigger',
+ builder: function() {
+ return new Ext.Toolbar.Button({
+ text: _("Re-run Internal EPG Grabbers"),
+ tooltip: _('Re-run all internal EPG grabbers to import EPG data now'),
+ iconCls: 'find',
+ });
+ },
+ callback: function(conf) {
+ tvheadend.Ajax({
+ url: 'api/epggrab/internal/rerun',
+ params: { rerun: 1 },
+ });
+ }
+ };
+}
+
tvheadend.epggrab_base = function(panel, index) {
var triggerButton = {
tabIndex: index,
width: 550,
labelWidth: 200,
- tbar: [triggerButton]
+ tbar: [triggerButton, tvheadend.epggrab_rerun_button()]
});
}
fields: ['uuid', 'title', 'status'],
list: { url: 'api/epggrab/module/list', params: { } },
lcol: [actions],
- plugins: [actions]
+ plugins: [actions],
+ tbar: [tvheadend.epggrab_rerun_button()]
});
};