summaryrefslogtreecommitdiff
path: root/pages/switch_channel.ecpp
diff options
context:
space:
mode:
Diffstat (limited to 'pages/switch_channel.ecpp')
-rw-r--r--pages/switch_channel.ecpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/pages/switch_channel.ecpp b/pages/switch_channel.ecpp
new file mode 100644
index 0000000..501715e
--- /dev/null
+++ b/pages/switch_channel.ecpp
@@ -0,0 +1,31 @@
+<%pre>
+#include <vdr/channels.h>
+#include "exception.h"
+#include "tasks.h"
+#include "tools.h"
+
+using namespace vdrlive;
+
+</%pre>
+<%args>
+ tChannelID channelid;
+</%args>
+<%cpp>
+ bool result = false;
+
+ reply.setContentType( "application/xml" );
+
+ ReadLock channelsLock( Channels );
+ if ( channelsLock ) {
+ cChannel* channel = Channels.GetByChannelID( channelid );
+ if ( channel != 0 )
+ result = LiveTaskManager().SwitchChannel( channel->Number() );
+ }
+</%cpp>
+<?xml version="1.0"?>
+<service>
+<request name="switch_channel">
+<param name="channel"><$ *channelid.ToString() $></param>
+</request>
+<response><$ result ? "1" : "0" $></response>
+</service>