Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http server: /playlist and /xmltv urls are in sync now
  • Loading branch information
perexg committed Oct 28, 2015
1 parent 33aa6ab commit 9d28df5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/uuid.c
Expand Up @@ -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;
}
5 changes: 5 additions & 0 deletions src/uuid.h
Expand Up @@ -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
*/
Expand Down
8 changes: 7 additions & 1 deletion src/webui/webui.c
Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions src/webui/xmltv.c
Expand Up @@ -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"))
Expand All @@ -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);
Expand Down

0 comments on commit 9d28df5

Please sign in to comment.