]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
iptv: fix channel icon handling, fixes #5240
authorJaroslav Kysela <perex@perex.cz>
Fri, 5 Oct 2018 07:53:50 +0000 (09:53 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 5 Oct 2018 07:54:12 +0000 (09:54 +0200)
src/channels.c
src/input/mpegts/iptv/iptv_service.c

index 7175ed876afb91efe620c8de9d82855532c9c158..6246b4294d0ad18275828bcdfe16bf50cb2260a8 100644 (file)
@@ -947,7 +947,7 @@ int channel_set_icon ( channel_t *ch, const char *icon )
 {
   int save = 0;
   if (!ch || !icon) return 0;
-  if (!ch->ch_icon || strcmp(ch->ch_icon, icon) ) {
+  if (!ch->ch_icon || strcmp(ch->ch_icon, icon)) {
     if (ch->ch_icon) free(ch->ch_icon);
     ch->ch_icon = strdup(icon);
     save = 1;
index 554e35b71186682bdd307c59a3aa2da0febff36d..7280fefcea4d1d2071d03c1bcd17bde072511268 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "iptv_private.h"
 #include "settings.h"
+#include "config.h"
 
 extern const idclass_t mpegts_service_class;
 
@@ -66,15 +67,26 @@ iptv_service_channel_icon ( service_t *s )
   iptv_mux_t       *im = (iptv_mux_t *)is->s_dvb_mux;
   iptv_network_t   *in = (iptv_network_t *)im->mm_network;
   const char       *ic = im->mm_iptv_icon;
+  const char       *dir = NULL;
   if (ic && ic[0]) {
     if (strncmp(ic, "http://", 7) == 0 ||
-        strncmp(ic, "https://", 8) == 0)
+        strncmp(ic, "https://", 8) == 0 ||
+        strncmp(ic, "file:///", 8) == 0)
       return ic;
-    if (strncmp(ic, "file:///", 8) == 0)
-      return ic + 7;
-    if (strncmp(ic, "file://", 7) == 0)
+    if (strncmp(ic, "file://", 7) == 0) {
+      const char *chicon = config.chicon_path;
       ic += 7;
-    if (in && in->in_icon_url && in->in_icon_url[0]) {
+      if (chicon && chicon[0] >= ' ' && chicon[0] <= 122) {
+        dir = chicon;
+      } else {
+        dir = "file:///";
+      }
+    } else {
+      if (in && in->in_icon_url && in->in_icon_url[0])
+        dir = in->in_icon_url;
+    }
+    if (dir && ic) {
+      while (ic[0] == '/') ic++;
       snprintf(prop_sbuf, PROP_SBUF_LEN, "%s/%s", in->in_icon_url, ic);
       return prop_sbuf;
     }