]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
xmltv: save category and keyword always in lowercase
authorJaroslav Kysela <perex@perex.cz>
Fri, 12 Jan 2018 08:17:58 +0000 (09:17 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 12 Jan 2018 08:17:58 +0000 (09:17 +0100)
src/epggrab/module/xmltv.c
src/string_list.c
src/string_list.h

index 5e95dc921f84fef36fae0e5d4004f2e6f0a4583c..5945be56d6ddf186086425421adfb7a0fcfa7c50 100644 (file)
@@ -538,7 +538,7 @@ static string_list_t *
       const char *str = htsmsg_get_str(e, "cdata");
       if (str && *str) {
         if (!tag_list) tag_list = string_list_create();
-        string_list_insert(tag_list, str);
+        string_list_insert_lowercase(tag_list, str);
       }
     }
   }
index f003ab750076556e19547a0732168804b47040f8..35d7e4cf62e2173578c910f1448669a556e6ee23 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "string_list.h"
 
+#include <ctype.h>
 #include <string.h>
 #include "htsmsg.h"
 
@@ -70,6 +71,18 @@ string_list_insert(string_list_t *l, const char *id)
   }
 }
 
+void
+string_list_insert_lowercase(string_list_t *l, const char *id)
+{
+  char *s, *p;
+
+  if (!id) return;
+  s = alloca(strlen(id) + 1);
+  for (s = p = alloca(strlen(id) + 1); *id; id++, p++)
+    *p = tolower(*id);
+  string_list_insert(l, s);
+}
+
 htsmsg_t *
 string_list_to_htsmsg(const string_list_t *l)
 {
index 1d6c474039fbfb1b65c859b8305a3fb4f3a329f9..324e8ef0d2245814ffa58e2ff4dc5bad1bf4cedb 100644 (file)
@@ -57,6 +57,9 @@ void string_list_destroy(string_list_t *l);
 /// Insert a copy of id in to the sorted string list.
 void string_list_insert(string_list_t *l, const char *id);
 
+/// Insert a copy of lowercase id in to the sorted string list.
+void string_list_insert_lowercase(string_list_t *l, const char *id);
+
 /// Conversion function from sorted string list to an htsmsg.
 /// @return NULL if empty.
 struct htsmsg *string_list_to_htsmsg(const string_list_t *l)