From: Jaroslav Kysela Date: Wed, 28 Oct 2015 21:10:13 +0000 (+0100) Subject: http server: /playlist and /xmltv urls are in sync now X-Git-Tag: v4.2.1~1747 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9d28df5cf8608976a37b7c264e2c8b9f0aaa1ab2;p=thirdparty%2Ftvheadend.git http server: /playlist and /xmltv urls are in sync now --- diff --git a/src/uuid.c b/src/uuid.c index 925d69e20..a91b690a0 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -160,3 +160,16 @@ uuid_hex2bin ( const tvh_uuid_t *a, tvh_uuid_t *b ) memcpy(b, &tmp, sizeof(tmp)); return 0; } + +/* Validate hex string */ +int +uuid_hexvalid ( const char *uuid ) +{ + int i; + if (uuid == NULL) + return 0; + for (i = 0; i < UUID_HEX_SIZE - 1; i++) + if (hexnibble(uuid[i]) < 0) + return 0; + return 1; +} diff --git a/src/uuid.h b/src/uuid.h index a5867b06b..fcd775ad4 100644 --- a/src/uuid.h +++ b/src/uuid.h @@ -59,6 +59,11 @@ int uuid_bin2hex ( const tvh_uuid_t *a, tvh_uuid_t *b ); */ int uuid_hex2bin ( const tvh_uuid_t *a, tvh_uuid_t *b ); +/** + * Valid hex uuid + */ +int uuid_hexvalid ( const char *uuid ); + /** * Hex string to binary */ diff --git a/src/webui/webui.c b/src/webui/webui.c index 4880dcd0e..a778e6db0 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -981,8 +981,14 @@ page_http_playlist(http_connection_t *hc, const char *remain, void *opaque) de = dvr_entry_find_by_id(atoi(components[1])); else if(nc == 2 && !strcmp(components[0], "tagid")) tag = channel_tag_find_by_identifier(atoi(components[1])); - else if(nc == 2 && !strcmp(components[0], "tag")) + else if(nc == 2 && !strcmp(components[0], "tagname")) tag = channel_tag_find_by_name(components[1], 0); + else if(nc == 2 && !strcmp(components[0], "tag")) { + if (uuid_hexvalid(components[1])) + tag = channel_tag_find_by_uuid(components[1]); + else + tag = channel_tag_find_by_name(components[1], 0); + } if(ch) r = http_channel_playlist(hc, pltype, ch); diff --git a/src/webui/xmltv.c b/src/webui/xmltv.c index a5ce4de95..7d172aaed 100644 --- a/src/webui/xmltv.c +++ b/src/webui/xmltv.c @@ -229,8 +229,8 @@ page_xmltv(http_connection_t *hc, const char *remain, void *opaque) pthread_mutex_lock(&global_lock); - if (nc == 2 && !strcmp(components[0], "channeluuid")) - ch = channel_find_by_uuid(components[1]); + if (nc == 2 && !strcmp(components[0], "channelid")) + ch = channel_find_by_id(atoi(components[1])); else if (nc == 2 && !strcmp(components[0], "channelnumber")) ch = channel_find_by_number(components[1]); else if (nc == 2 && !strcmp(components[0], "channelname")) @@ -239,8 +239,10 @@ page_xmltv(http_connection_t *hc, const char *remain, void *opaque) ch = channel_find(components[1]); else if (nc == 2 && !strcmp(components[0], "tagid")) tag = channel_tag_find_by_identifier(atoi(components[1])); - else if (nc == 2 && !strcmp(components[0], "tag")) + else if (nc == 2 && !strcmp(components[0], "tagname")) tag = channel_tag_find_by_name(components[1], 0); + else if (nc == 2 && !strcmp(components[0], "tag")) + tag = channel_tag_find_by_uuid(components[1]); if (ch) { r = http_xmltv_channel(hc, ch);