661 |
661 |
HTSMSG_FOREACH(f, tags) {
|
662 |
662 |
if (!(subtag = htsmsg_field_get_map(f))) continue;
|
663 |
663 |
if (strcmp(f->hmf_name, "display-name") == 0) {
|
664 |
|
int n = 0;
|
665 |
|
|
666 |
664 |
name = htsmsg_get_str(subtag, "cdata");
|
667 |
|
if (chnum && name) {
|
668 |
|
while (isdigit(*(name + n))) n++;
|
669 |
|
if (n > 0) {
|
670 |
|
if (*(name + n) == 0 || (*(name + n) == ' ' && chnum == 1)) {
|
671 |
|
save |= epggrab_channel_set_number(ch, atoi(name), 0);
|
672 |
|
name += n;
|
673 |
|
while (*name == ' ') name++;
|
674 |
|
}
|
675 |
|
}
|
|
665 |
int major = 0;
|
|
666 |
int minor = 0;
|
|
667 |
const char *cur = name;
|
|
668 |
|
|
669 |
/* Some xmltv providers supply a display-name that is the
|
|
670 |
* channel number. So attempt to grab it.
|
|
671 |
*/
|
|
672 |
|
|
673 |
/* Check and grab major part of channel number */
|
|
674 |
while (isdigit(*cur))
|
|
675 |
major = (major * 10) + *cur++ - '0';
|
|
676 |
|
|
677 |
/* If a period then it's an atsc-style number of major.minor.
|
|
678 |
* So skip the period and parse the minor.
|
|
679 |
*/
|
|
680 |
if (major && *cur == '.') {
|
|
681 |
++cur;
|
|
682 |
while (isdigit(*cur))
|
|
683 |
minor = (minor * 10) + *cur++ - '0';
|
676 |
684 |
}
|
677 |
|
if (name && *name)
|
678 |
|
htsmsg_add_str_exclusive(dnames, name);
|
|
685 |
|
|
686 |
/* If we have a channel number and then either end of string
|
|
687 |
* or (if chnum is 'first words') a space, then save the channel.
|
|
688 |
* The space is necessary to avoid channels such as "4Music"
|
|
689 |
* being treated as channel number 4.
|
|
690 |
*
|
|
691 |
* We assume channel number has to be >0.
|
|
692 |
*/
|
|
693 |
if (major && (!*cur || (*cur == ' ' && chnum == 1))) {
|
|
694 |
save |= epggrab_channel_set_number(ch, major, minor);
|
|
695 |
/* Skip extra spaces between channel number and actual name */
|
|
696 |
while (*cur == ' ') ++cur;
|
|
697 |
}
|
|
698 |
|
|
699 |
if (cur && *cur)
|
|
700 |
htsmsg_add_str_exclusive(dnames, cur);
|
679 |
701 |
}
|
680 |
702 |
else if (strcmp(f->hmf_name, "icon") == 0) {
|
681 |
703 |
if ((attribs = htsmsg_get_map(subtag, "attrib")) != NULL &&
|
682 |
|
-
|