]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
epg: fix channel-name DESC sort (was calling description sort)
authorOliver Sluke <22557015+oliversluke@users.noreply.github.com>
Sat, 16 May 2026 21:17:29 +0000 (23:17 +0200)
committerFlole <Flole998@users.noreply.github.com>
Fri, 5 Jun 2026 23:22:52 +0000 (01:22 +0200)
src/epg.c:2607-2610 — `_epg_sort_channel_descending` delegates to
`_epg_sort_description_ascending` and negates, so a request for
channel-name DESC returns events ordered by reverse description
text instead of reverse channel name. Rows cluster by adjacent
description prose, not by channel.

The sibling `_epg_sort_channel_ascending` (lines 2598-2605) uses
`channel_get_name` correctly, and every other `_descending`
variant in the file delegates to its own `_ascending` (title,
subtitle, summary, description, extratext, genre). Channel is
the only outlier — a copy-paste typo.

Fix: delegate to `_epg_sort_channel_ascending`.

Verifiable via:
  curl 'http://<host>/api/epg/events/grid?sort=channelName&dir=DESC&limit=20'

Pre-fix: rows interleave by description text. Post-fix: rows
cluster by channel in reverse alphabetical order.

Signed-off-by: Oliver Sluke <22557015+oliversluke@users.noreply.github.com>
src/epg.c

index 08f24c5322b6c1858c9dff7e7707f84049814b06..7d95b27466e070a6c76b37ef3a945cd9e980d683 100644 (file)
--- a/src/epg.c
+++ b/src/epg.c
@@ -2606,7 +2606,7 @@ static int _epg_sort_channel_ascending ( const void *a, const void *b, void *eq
 
 static int _epg_sort_channel_descending ( const void *a, const void *b, void *eq )
 {
-  return _epg_sort_description_ascending(a, b, eq) * -1;
+  return _epg_sort_channel_ascending(a, b, eq) * -1;
 }
 
 static int _epg_sort_channel_num_ascending ( const void *a, const void *b, void *eq )