Add a channelno url to play a channel by its user assigned number

This commit is contained in:
BtbN 2014-02-09 18:49:41 +01:00
parent a3c1599120
commit 6f6944c8e7
3 changed files with 16 additions and 0 deletions

View file

@ -400,6 +400,16 @@ channel_find_by_id ( uint32_t i )
return RB_FIND(&channels, &skel, ch_link, ch_id_cmp);
}
channel_t *
channel_find_by_number ( int no )
{
channel_t *ch;
CHANNEL_FOREACH(ch)
if(channel_get_number(ch) == no)
break;
return ch;
}
/* **************************************************************************
* Property updating
* *************************************************************************/

View file

@ -135,6 +135,8 @@ channel_t *channel_find_by_name(const char *name);
channel_t *channel_find_by_id(uint32_t id);
channel_t *channel_find_by_number(int no);
#define channel_find channel_find_by_uuid
int channel_set_tags_by_list ( channel_t *ch, htsmsg_t *tags );

View file

@ -611,6 +611,8 @@ page_http_playlist(http_connection_t *hc, const char *remain, void *opaque)
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(atoi(components[1]));
else if(nc == 2 && !strcmp(components[0], "channel"))
ch = channel_find(components[1]);
else if(nc == 2 && !strcmp(components[0], "dvrid"))
@ -883,6 +885,8 @@ http_stream(http_connection_t *hc, const char *remain, void *opaque)
if(!strcmp(components[0], "channelid")) {
ch = channel_find_by_id(atoi(components[1]));
} else if(!strcmp(components[0], "channelnumber")) {
ch = channel_find_by_number(atoi(components[1]));
} else if(!strcmp(components[0], "channel")) {
ch = channel_find(components[1]);
} else if(!strcmp(components[0], "service")) {