From 143beb4eb2b1deb8cfca0a8745b278e53ae6a46c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 18 Sep 2017 20:19:15 +0200 Subject: [PATCH] epg: try to fix epg_episode_number_cmp() for text episode version --- src/epg.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/epg.c b/src/epg.c index 1e898d74c..5ede01463 100644 --- 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 -- 2.47.2