]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http server: /playlist and /xmltv urls are in sync now
authorJaroslav Kysela <perex@perex.cz>
Wed, 28 Oct 2015 21:10:13 +0000 (22:10 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 28 Oct 2015 21:10:13 +0000 (22:10 +0100)
src/uuid.c
src/uuid.h
src/webui/webui.c
src/webui/xmltv.c

index 925d69e20c5bdb2b64b051604ffed6a7ffa668b5..a91b690a04542ca6ecd54e371e80255434d0b574 100644 (file)
@@ -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;
+}
index a5867b06ba7dbb613bc2aaf93c8395e8c78e49cd..fcd775ad4af660a1f3ad7cddbc55f2bea65e2ac8 100644 (file)
@@ -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
  */
index 4880dcd0ea408d0d7958d2e0c91f405aafe19a24..a778e6db0ee46ea5247f29797450629f09515ed3 100644 (file)
@@ -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);
index a5ce4de95cf738ff47e10527f3a9af55565fe208..7d172aaed62ada53adc0553c31c23f296888c98b 100644 (file)
@@ -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);