]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epg: sort by title and if equal - sort by subtitle
authorJaroslav Kysela <perex@perex.cz>
Thu, 1 Sep 2016 11:41:05 +0000 (13:41 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 1 Sep 2016 11:41:05 +0000 (13:41 +0200)
src/epg.c

index aeafe62c59d7ec123cd4152c470bb69303437c13..2e9e0f986d1c59ca94fd713209d89536dc03c2d9 100644 (file)
--- a/src/epg.c
+++ b/src/epg.c
@@ -2718,7 +2718,16 @@ static int _epg_sort_title_ascending ( const void *a, const void *b, void *eq )
   if (s1 == NULL && s2 == NULL) return 0;
   if (s1 == NULL && s2) return 1;
   if (s1 && s2 == NULL) return -1;
-  return strcmp(s1, s2);
+  int r = strcmp(s1, s2);
+  if (r == 0) {
+    s1 = epg_broadcast_get_subtitle(*(epg_broadcast_t**)a, ((epg_query_t *)eq)->lang);
+    s2 = epg_broadcast_get_subtitle(*(epg_broadcast_t**)b, ((epg_query_t *)eq)->lang);
+    if (s1 == NULL && s2 == NULL) return 0;
+    if (s1 == NULL && s2) return 1;
+    if (s1 && s2 == NULL) return -1;
+    r = strcmp(s1, s2);
+  }
+  return r;
 }
 
 static int _epg_sort_title_descending ( const void *a, const void *b, void *eq )