Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
channels: add Auto EPG Channel, fixes #2520
  • Loading branch information
perexg committed Nov 30, 2014
1 parent 01e7cc1 commit abfae4c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
5 changes: 5 additions & 0 deletions docs/html/config_channels.html
Expand Up @@ -36,6 +36,11 @@
display a direct link that can be used to open in preferred media
player.

<dt>Auto EPG Channel
<dd>Auto-link EPG channels from XMLTV and OpenTV EPG grabbers using
the channel name for matching. If you turn this option off, only
OTA EPG grabber will be used for this channel.

<dt>EPG Grab Source
<dd>Name of the Internet-based EPG provider (typically XMLTV) channel
that should be used to update this channels EPG info.
Expand Down
24 changes: 21 additions & 3 deletions src/channels.c
Expand Up @@ -248,9 +248,11 @@ channel_class_epggrab_set ( void *o, const void *v )
}

/* Link */
HTSMSG_FOREACH(f, l) {
if ((ec = epggrab_channel_find_by_id(htsmsg_field_get_str(f))))
save |= epggrab_channel_link(ec, ch);
if (ch->ch_epgauto && l) {
HTSMSG_FOREACH(f, l) {
if ((ec = epggrab_channel_find_by_id(htsmsg_field_get_str(f))))
save |= epggrab_channel_link(ec, ch);
}
}

/* Delete */
Expand All @@ -277,6 +279,14 @@ channel_class_epggrab_list ( void *o )
return m;
}

static void
channel_class_epgauto_notify ( void *obj )
{
channel_t *ch = obj;
if (!ch->ch_epgauto)
channel_class_epggrab_set(obj, NULL);
}

static const void *
channel_class_bouquet_get ( void *o )
{
Expand Down Expand Up @@ -348,6 +358,13 @@ const idclass_t channel_class = {
.get = channel_class_get_icon,
.opts = PO_RDONLY | PO_NOSAVE | PO_HIDDEN,
},
{
.type = PT_BOOL,
.id = "epgauto",
.name = "Auto EPG Channel",
.off = offsetof(channel_t, ch_epgauto),
.notify = channel_class_epgauto_notify,
},
{
.type = PT_STR,
.islist = 1,
Expand Down Expand Up @@ -731,6 +748,7 @@ channel_create0

/* Defaults */
ch->ch_enabled = 1;
ch->ch_epgauto = 1;

if (conf) {
ch->ch_load = 1;
Expand Down
1 change: 1 addition & 0 deletions src/channels.h
Expand Up @@ -68,6 +68,7 @@ typedef struct channel
gtimer_t ch_epg_timer_head;
gtimer_t ch_epg_timer_current;

int ch_epgauto;
LIST_HEAD(,epggrab_channel_link) ch_epggrab;

/* DVR */
Expand Down
2 changes: 1 addition & 1 deletion src/epggrab/channel.c
Expand Up @@ -36,7 +36,7 @@ SKEL_DECLARE(epggrab_channel_skel, epggrab_channel_t);
/* Check if channels match */
int epggrab_channel_match ( epggrab_channel_t *ec, channel_t *ch )
{
if (!ec || !ch) return 0;
if (!ec || !ch || !ch->ch_epgauto) return 0;
if (LIST_FIRST(&ec->channels)) return 0; // ignore already paired

if (ec->name && !strcmp(ec->name, channel_get_name(ch))) return 1;
Expand Down

0 comments on commit abfae4c

Please sign in to comment.