epggrab: hide OTA channels from epggrab config

These are clearly intended to all be automatic, users should not be able
to change these.
This commit is contained in:
Adam Sutton 2013-11-12 12:06:23 +00:00
parent b5c6b7a6e8
commit 173b0af80d
5 changed files with 24 additions and 16 deletions

View file

@ -28,7 +28,7 @@ api_epggrab_channel_list
{
htsmsg_t *m;
pthread_mutex_lock(&global_lock);
m = epggrab_channel_list();
m = epggrab_channel_list(0);
pthread_mutex_unlock(&global_lock);
*resp = htsmsg_create_map();
htsmsg_add_msg(*resp, "entries", m);

View file

@ -211,8 +211,10 @@ channel_class_epggrab_get ( void *o )
channel_t *ch = o;
htsmsg_t *l = htsmsg_create_list();
epggrab_channel_link_t *ecl;
LIST_FOREACH(ecl, &ch->ch_epggrab, ecl_chn_link)
htsmsg_add_str(l, NULL, epggrab_channel_get_id(ecl->ecl_epggrab));
LIST_FOREACH(ecl, &ch->ch_epggrab, ecl_chn_link) {
if (!epggrab_channel_is_ota(ecl->ecl_epggrab))
htsmsg_add_str(l, NULL, epggrab_channel_get_id(ecl->ecl_epggrab));
}
return l;
}
@ -227,8 +229,10 @@ channel_class_epggrab_set ( void *o, const void *v )
epggrab_channel_link_t *ecl, *n;
/* mark for deletion */
LIST_FOREACH(ecl, &ch->ch_epggrab, ecl_chn_link)
ecl->ecl_mark = 1;
LIST_FOREACH(ecl, &ch->ch_epggrab, ecl_chn_link) {
if (!epggrab_channel_is_ota(ecl->ecl_epggrab))
ecl->ecl_mark = 1;
}
/* Link */
HTSMSG_FOREACH(f, l) {

View file

@ -98,7 +98,7 @@ typedef struct epggrab_channel_link
/*
* Access functions
*/
htsmsg_t* epggrab_channel_list ( void );
htsmsg_t* epggrab_channel_list ( int ota );
/*
* Mutators
@ -118,6 +118,11 @@ int epggrab_channel_link ( epggrab_channel_t *ec, struct channel *ch );
const char *epggrab_channel_get_id ( epggrab_channel_t *ch );
epggrab_channel_t *epggrab_channel_find_by_id ( const char *id );
/*
* Check type
*/
int epggrab_channel_is_ota ( epggrab_channel_t *ec );
/* **************************************************************************
* Grabber Modules
* *************************************************************************/
@ -130,9 +135,9 @@ struct epggrab_module
LIST_ENTRY(epggrab_module) link; ///< Global list link
enum {
EPGGRAB_OTA,
EPGGRAB_INT,
EPGGRAB_EXT,
EPGGRAB_OTA
} type; ///< Grabber type
const char *id; ///< Module identifier
const char *name; ///< Module name (for display)

View file

@ -215,7 +215,7 @@ epggrab_channel_t *epggrab_channel_find
* Global routines
* *************************************************************************/
htsmsg_t *epggrab_channel_list ( void )
htsmsg_t *epggrab_channel_list ( int ota )
{
char name[500];
epggrab_module_t *mod;
@ -223,6 +223,7 @@ htsmsg_t *epggrab_channel_list ( void )
htsmsg_t *e, *m;
m = htsmsg_create_list();
LIST_FOREACH(mod, &epggrab_modules, link) {
if (!ota && (mod->type == EPGGRAB_OTA)) continue;
if (mod->channels) {
RB_FOREACH(ec, mod->channels, link) {
e = htsmsg_create_map();
@ -283,3 +284,9 @@ epggrab_channel_find_by_id ( const char *id )
return epggrab_channel_find(mod->channels, cid, 0, NULL, NULL);
return NULL;
}
int
epggrab_channel_is_ota ( epggrab_channel_t *ec )
{
return ec->mod->type == EPGGRAB_OTA;
}

View file

@ -441,14 +441,6 @@ extjs_epggrab(http_connection_t *hc, const char *remain, void *opaque)
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;