int delim;
size_t l;
int64_t chnum2;
- const char *url, *name, *logo, *epgid;
+ const char *url, *name, *logo, *epgid, *tags;
char url2[512], custom[512], name2[128], buf[32], *n, *y;
url = htsmsg_get_str(item, "m3u-url");
logo = htsmsg_get_str(item, "logo");
epgid = htsmsg_get_str(item, "tvg-id");
+ tags = htsmsg_get_str(item, "tvh-tags");
+ if (tags) {
+ tags = n = strdupa(tags);
+ while (*n) {
+ if (*n == '|')
+ *n = '\n';
+ n++;
+ }
+ }
urlinit(&u);
custom[0] = '\0';
im->mm_iptv_hdr = strdup(custom);
change = 1;
}
+ if (strcmp(im->mm_iptv_tags ?: "", tags ?: "")) {
+ free(im->mm_iptv_tags);
+ im->mm_iptv_tags = strdup(tags);
+ change = 1;
+ }
if (change)
idnode_notify_changed(&im->mm_id);
(*total)++;
htsmsg_add_str(conf, "iptv_icon", logo);
if (epgid)
htsmsg_add_str(conf, "iptv_epgid", epgid);
+ if (tags)
+ htsmsg_add_str(conf, "iptv_tags", tags);
if (!in->in_scan_create)
htsmsg_add_s32(conf, "scan_result", MM_SCAN_OK);
if (custom[0])
.off = offsetof(iptv_mux_t, mm_iptv_hdr),
.opts = PO_ADVANCED | PO_MULTILINE
},
+ {
+ .type = PT_STR,
+ .id = "iptv_tags",
+ .name = N_("Channel tags"),
+ .off = offsetof(iptv_mux_t, mm_iptv_tags),
+ .opts = PO_ADVANCED | PO_MULTILINE
+ },
{}
}
};
free(im->mm_iptv_svcname);
free(im->mm_iptv_env);
free(im->mm_iptv_hdr);
+ free(im->mm_iptv_tags);
free(im->mm_iptv_icon);
free(im->mm_iptv_epgid);
mpegts_mux_delete(mm, delconf);
int mm_iptv_kill_timeout;
char *mm_iptv_env;
char *mm_iptv_hdr;
+ char *mm_iptv_tags;
uint32_t mm_iptv_rtp_seq;
return im->mm_iptv_epgid;
}
+static htsmsg_t *
+iptv_service_channel_tags ( service_t *s )
+{
+ iptv_service_t *is = (iptv_service_t *)s;
+ iptv_mux_t *im = (iptv_mux_t *)is->s_dvb_mux;
+ char *p = im->mm_iptv_tags, *x;
+ htsmsg_t *r = NULL;
+ if (p) {
+ r = htsmsg_create_list();
+ while (*p) {
+ while (*p && *p <= ' ') p++;
+ x = p;
+ while (*p && *p >= ' ') p++;
+ if (*p) { *p = '\0'; p++; }
+ if (*x)
+ htsmsg_add_str(r, NULL, x);
+ }
+ }
+ return r;
+}
+
/*
* Create
*/
is->s_channel_number = iptv_service_channel_number;
is->s_channel_icon = iptv_service_channel_icon;
is->s_channel_epgid = iptv_service_channel_epgid;
+ is->s_channel_tags = iptv_service_channel_tags;
/* Set default service name */
if (!is->s_dvb_svcname || !*is->s_dvb_svcname)
int64_t (*s_channel_number) (struct service *);
const char *(*s_channel_name) (struct service *);
const char *(*s_channel_epgid) (struct service *);
+ htsmsg_t *(*s_channel_tags) (struct service *);
const char *(*s_provider_name) (struct service *);
const char *(*s_channel_icon) (struct service *);
void (*s_mapped) (struct service *);
service_mapper_process ( service_t *s, bouquet_t *bq )
{
channel_t *chn = NULL;
- const char *name;
+ const char *name, *tagname;
+ htsmsg_field_t *f;
+ htsmsg_t *m;
/* Ignore */
if (s->s_status == SERVICE_ZOMBIE) {
channel_tag_map(channel_tag_find_by_name("Radio", 1), chn, chn);
}
+ /* Custom tags */
+ if (s->s_channel_tags && (m = s->s_channel_tags(s)) != NULL)
+ HTSMSG_FOREACH(f, m)
+ if ((tagname = htsmsg_field_get_str(f)) != NULL)
+ channel_tag_map(channel_tag_find_by_name(tagname, 1), chn, chn);
+
/* Provider */
if (service_mapper_conf.provider_tags)
if ((prov = s->s_provider_name(s)))