]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epg: try to fix epg_episode_number_cmp() for text episode version
authorJaroslav Kysela <perex@perex.cz>
Mon, 18 Sep 2017 18:19:15 +0000 (20:19 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 18 Sep 2017 19:05:02 +0000 (21:05 +0200)
src/epg.c

index 1e898d74cbab2348a6b7edecdcfd5b291bfa5f44..5ede01463a2ef17dbf18eb31bd9512b3dc80d050 100644 (file)
--- a/src/epg.c
+++ b/src/epg.c
@@ -1289,13 +1289,18 @@ void epg_episode_get_epnum ( epg_episode_t *ee, epg_episode_num_t *num )
 
 int epg_episode_number_cmp ( epg_episode_num_t *a, epg_episode_num_t *b )
 {
-  if (a->s_num != b->s_num) {
-    return a->s_num - b->s_num;
-  } else if (a->e_num != b->e_num) {
-    return a->e_num - b->e_num;
-  } else {
-    return a->p_num - b->p_num;
+  if (a->e_num) {
+    if (a->s_num != b->s_num) {
+      return a->s_num - b->s_num;
+    } else if (a->e_num != b->e_num) {
+      return a->e_num - b->e_num;
+    } else {
+      return a->p_num - b->p_num;
+    }
+  } else if (a->text && b->text) {
+    return strcmp(a->text, b->text);
   }
+  return 0;
 }
 
 // WIBNI: this could do with soem proper matching, maybe some form of