]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add a channelno url to play a channel by its user assigned number
authorBtbN <btbn@btbn.de>
Sun, 9 Feb 2014 17:49:41 +0000 (18:49 +0100)
committerBtbN <btbn@btbn.de>
Wed, 12 Feb 2014 16:14:47 +0000 (17:14 +0100)
src/channels.c
src/channels.h
src/webui/webui.c

index 749fcb9c381b19f1f626fa761efc9fbec9d7836d..130d3be6d4d8561d3886a0ad14780a82df47c14d 100644 (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
  * *************************************************************************/
index 080079aac46fba0304c660717939cab38c1031f3..9fa688c57ef5b9ca52f0be9645331e43160c65a3 100644 (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 );
index 10de15a765ed67468c745c274cc974af41869a92..cf10d8b56863db858e1efa22454140b3f29b5830 100644 (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")) {