From d3d0249bce84425e94e4bee399b7f2236f77b6bf Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 28 Dec 2018 19:50:05 +0100 Subject: [PATCH] htsp server: use HTTP image URLs for image cache for older clients (pvr.hts), fixes #5455 --- src/htsp_server.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/htsp_server.c b/src/htsp_server.c index f115c0ee6..a7f8a79e0 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -50,7 +50,7 @@ static void *htsp_server, *htsp_server_2; -#define HTSP_PROTO_VERSION 33 +#define HTSP_PROTO_VERSION 34 #define HTSP_ASYNC_OFF 0x00 #define HTSP_ASYNC_ON 0x01 @@ -340,14 +340,15 @@ htsp_flush_queue(htsp_connection_t *htsp, htsp_msg_q_t *hmq, int dead) * */ static const char * -htsp_image(htsp_connection_t *htsp, const char *image, char *buf, size_t buflen) +htsp_image(htsp_connection_t *htsp, const char *image, + char *buf, size_t buflen, int version) { const char *ret = image; const int id = imagecache_get_id(image); /* Handle older clients */ if (id) { - if (htsp->htsp_version < 8) { + if (htsp->htsp_version < version) { struct sockaddr_storage addr; socklen_t addrlen; char abuf[50]; @@ -870,7 +871,7 @@ htsp_build_channel(channel_t *ch, const char *method, htsp_connection_t *htsp) htsmsg_add_str(out, "channelName", channel_get_name(ch, channel_blank_name)); if ((icon = channel_get_icon(ch))) - htsmsg_add_str(out, "channelIcon", htsp_image(htsp, icon, buf, sizeof(buf))); + htsmsg_add_str(out, "channelIcon", htsp_image(htsp, icon, buf, sizeof(buf), 8)); now = ch->ch_epg_now; next = ch->ch_epg_next; @@ -931,7 +932,7 @@ htsp_build_tag(htsp_connection_t *htsp, channel_tag_t *ct, const char *method, i htsmsg_add_str(out, "tagName", ct->ct_name); icon = channel_tag_get_icon(ct); if (!strempty(icon)) - htsmsg_add_str(out, "tagIcon", htsp_image(htsp, icon, buf, sizeof(buf))); + htsmsg_add_str(out, "tagIcon", htsp_image(htsp, icon, buf, sizeof(buf), 34)); htsmsg_add_u32(out, "tagTitledIcon", ct->ct_titled_icon); if(members != NULL) { @@ -1036,11 +1037,11 @@ htsp_build_dvrentry(htsp_connection_t *htsp, dvr_entry_t *de, const char *method */ const char *image = dvr_entry_get_image(de); if(!strempty(image)) - htsmsg_add_str(out, "image", htsp_image(htsp, image, buf, sizeof(buf))); + htsmsg_add_str(out, "image", htsp_image(htsp, image, buf, sizeof(buf), 34)); /* htsmsg camelcase to be compatible with other names */ image = de->de_fanart_image; if(!strempty(image)) - htsmsg_add_str(out, "fanartImage", htsp_image(htsp, image, buf, sizeof(buf))); + htsmsg_add_str(out, "fanartImage", htsp_image(htsp, image, buf, sizeof(buf), 34)); if (de->de_copyright_year) htsmsg_add_u32(out, "copyrightYear", de->de_copyright_year); @@ -1305,7 +1306,7 @@ htsp_build_event epg_broadcast_get_epnum(e, &epnum); htsp_serialize_epnum(out, &epnum, NULL); if (!strempty(e->image)) - htsmsg_add_str(out, "image", htsp_image(htsp, e->image, buf, sizeof(buf))); + htsmsg_add_str(out, "image", htsp_image(htsp, e->image, buf, sizeof(buf), 34)); if (e->channel) { LIST_FOREACH(de, &e->channel->ch_dvrs, de_channel_link) { -- 2.47.2