<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
  <meta name="Generator" content="Zarafa WebAccess v7.1.1-37812">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>RE: [mythtv-users] New Sky+ App - control Sky box via tcp/ip network</title>
  <style type="text/css">
      body
      {
        font-family: Arial, Verdana, Sans-Serif ! important;
        font-size: 12px;
        padding: 5px 5px 5px 5px;
        margin: 0px;
        border-style: none;
        background-color: #ffffff;
      }

      p, ul, li
      {
        margin-top: 0px;
        margin-bottom: 0px;
      }
  </style>
</head>
<body>
<blockquote style="border-left: 2px solid #325FBA; padding-left: 5px;margin-left:5px;">-----Original message-----<br /><strong>From:</strong>        Michael Watson &lt;michael@thewatsonfamily.id.au&gt;<br /><strong>Sent:</strong>        Thu 13-12-2012 22:25<br /><strong>Subject:</strong>        Re: [mythtv-users] New Sky+ App - control Sky box via tcp/ip network<br /><strong>To:</strong>        Discussion about MythTV &lt;mythtv-users@mythtv.org&gt;; <br />On 14/12/2012 1:44 AM, Dave Pearson wrote:<br />&gt; RE: [mythtv-users] New Sky+ App - control Sky box via tcp/ip network<br />&gt;<br />&gt; &nbsp; &nbsp; -----Original message-----<br />&gt; &nbsp; &nbsp; *From:* Michael Watson &lt;michael@thewatsonfamily.id.au&gt;<br />&gt; &nbsp; &nbsp; *Sent:* Thu 13-12-2012 04:08<br />&gt; &nbsp; &nbsp; *Subject:* Re: [mythtv-users] New Sky+ App - control Sky box via<br />&gt; &nbsp; &nbsp; tcp/ip network<br />&gt; &nbsp; &nbsp; *To:* Discussion about MythTV &lt;mythtv-users@mythtv.org&gt;;<br />&gt; &nbsp; &nbsp; On 13/12/2012 1:41 PM, Nick Rout wrote:<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; On Thu, Dec 13, 2012 at 10:29 AM, Dave Pearson<br />&gt; &nbsp; &nbsp; &gt; &lt;lists@the-pearsons.co.uk &lt;mailto:lists@the-pearsons.co.uk&gt;&gt; wrote:<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; -----Original message-----<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; *From:* Raymond Wagner &lt;raymond@wagnerrp.com<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mailto:raymond@wagnerrp.com&gt;&gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; *Sent:* Thu 16-08-2012 21:14<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; *Subject:* Re: [mythtv-users] New Sky+ App - control Sky box<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; via tcp/ip network<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; *To:* Discussion about MythTV &lt;mythtv-users@mythtv.org<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &lt;mailto:mythtv-users@mythtv.org&gt;&gt;;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; On 8/16/2012 10:38, Dave Pearson wrote:<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &gt; Before anyone says why don&#39;t I do it myself - I&#39;m not<br />&gt; &nbsp; &nbsp; clever<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; enough!<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; Sure you are, you just don&#39;t know you are. Grab a copy of<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; wireshark or<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; tcpdump and have at it. Just start it up, and record the<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; communications<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; between the iPad and the STB as you perform various actions.<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; The only<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; real difficulty would be if they decided it was necessary to<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; perform<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; some kind of authentication between the STB and application,<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; or worse,<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; encrypted the communication.<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; _______________________________________________<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; mythtv-users mailing list<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; mythtv-users@mythtv.org &lt;mailto:mythtv-users@mythtv.org&gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; http://www.mythtv.org/mailman/listinfo/mythtv-users<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; OK, I wasn&#39;t clever enough to use wireshark to figure out how to<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; send the control commands to my SKY+HD Box, but someone else was<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; (http://www.gladdy.co.uk/blog/2012/08/21/the-skyhd-picasso-dnla-control-server-protocol/)<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; and using the information on that page I have been able to use<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; firefox poster to send a command to change the channel. I&#39;m now<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; trying to take what I&#39;m using in poster to create a bash script<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; that I can use to change the channel in mythtv,<br />&gt; &nbsp; &nbsp; unfortunately I&#39;m<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; having no luck with curl at all.<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; This is what I&#39;m POSTing using poster:<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; headers:<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; SOAPACTION:<br />&gt; &nbsp; &nbsp; urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; content-type: text/xml; charset=utf-8<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; body:<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;s:Envelope<br />&gt; &nbsp; &nbsp; &gt; s:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; xmlns:s=&quot;http://schemas.smlsoap.org/soap/envelope/&quot;&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;s:Body&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;u:SetAVTransportURI<br />&gt; &nbsp; &nbsp; xmlns:u=&quot;urn:schemas-nds-com:service:SkyPlay:2&quot;&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;InstanceID&gt;0&lt;/InstanceID&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;CurrentURI&gt;xsi://ff0&lt;/CurrentURI&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &lt;CurrentURIMetaData&gt;NOT_IMPLEMENTED&lt;/CurrentURIMetaData&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;/u:SetAVTransportURI&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;/s:Body&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &lt;/s:Envelope&gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; Using the above code in poster I mange to change the channel to<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; ff0, which is the hex code for channel 113 (Universal HD),<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; unfortunately I just cannot figure out how I can get curl to<br />&gt; &nbsp; &nbsp; POST<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; the body text (I think the headers are being passed<br />&gt; &nbsp; &nbsp; correctly. I&#39;m<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; sure this is really simple, but I&#39;m just stuck! any help will be<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; gratefully received.<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; Regards,<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; Dave<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; &gt; can wget do this?<br />&gt; &nbsp; &nbsp; &gt;<br />&gt; &nbsp; &nbsp; Possibly, but might be easier to use something like python or<br />&gt; &nbsp; &nbsp; perl, as<br />&gt; &nbsp; &nbsp; then end result is going to be a channel change script I guess.<br />&gt; &nbsp; &nbsp; This python code might do the trick.<br />&gt;<br />&gt;<br />&gt; &nbsp; &nbsp; import &nbsp;httplib, &nbsp;urllib<br />&gt; &nbsp; &nbsp; import &nbsp;re<br />&gt;<br />&gt; &nbsp; &nbsp; conn= &nbsp;httplib.HTTPConnection(&quot;http://xxx.xxx.xxx.xx<br />&gt; &nbsp; &nbsp; &nbsp;&lt;http://xxx.xxx.xxx.xx/&gt;:49153/SkyPlay2&quot;)<br />&gt; &nbsp; &nbsp; XML=&#39;*****XMLSTUFF Goes Here *****&#39;<br />&gt; &nbsp; &nbsp; headers= &nbsp;{ &nbsp;&quot;SOAPACTION:<br />&gt; &nbsp; &nbsp; urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI&quot;,<br />&gt; &nbsp; &nbsp; &nbsp;&quot;content-type: text/xml&quot;, &quot;charset=utf-8&quot;}<br />&gt; &nbsp; &nbsp; conn.request(&quot;POST&quot;, &nbsp;params, &nbsp;&quot;&quot;, &nbsp;headers)<br />&gt; &nbsp; &nbsp; conn.send(XML)<br />&gt; &nbsp; &nbsp; response= &nbsp;conn.getresponse()<br />&gt; &nbsp; &nbsp; print &nbsp;response.status, &nbsp;response.reason<br />&gt;<br />&gt; &nbsp; &nbsp; print &nbsp;response.read()<br />&gt; &nbsp; &nbsp; conn.close()<br />&gt;<br />&gt;<br />&gt;<br />&gt; &nbsp; &nbsp; _______________________________________________<br />&gt; &nbsp; &nbsp; mythtv-users mailing list<br />&gt; &nbsp; &nbsp; mythtv-users@mythtv.org<br />&gt; &nbsp; &nbsp; http://www.mythtv.org/mailman/listinfo/mythtv-users<br />&gt;<br />&gt; Thanks for your suggestion, unfortunately I don&#39;y know python at all, <br />&gt; so cannot really debug where it&#39;s going wrong.<br />&gt;<br />&gt; Perhaps it might help if I post the curl command that I am using:<br />&gt;<br />&gt; curl --verbose --header &quot;Content-Type: text/xml&quot; --header &quot;SOAPACTION: <br />&gt; urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI&quot; -d <br />&gt; @posterbody.xml -X POST http://192.168.1.202:49153/SkyPlay2<br />&gt;<br />&gt; and the contents of posterbody.xml:<br />&gt;<br />&gt; &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />&gt; &lt;s:Envelope <br />&gt; s:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; <br />&gt; xmlns:s=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;<br />&gt; &lt;s:Body&gt;<br />&gt; &lt;u:SetAVTransportURI xmlns:u=&quot;urn:schemas-nds-com:service:SkyPlay:2&quot;&gt;<br />&gt; &lt;InstanceID&gt;0&lt;/InstanceID&gt;<br />&gt; &lt;CurrentURI&gt;xsi://ff0&lt;/CurrentURI&gt;<br />&gt; &lt;CurrentURIMetaData&gt;NOT_IMPLEMENTED&lt;/CurrentURIMetaData&gt;<br />&gt; &lt;/u:SetAVTransportURI&gt;<br />&gt; &lt;/s:Body&gt;<br />&gt; &lt;/s:Envelope&gt;<br />&gt;<br />&gt; and this is what I get in return:<br />&gt;<br />&gt; * About to connect() to 192.168.1.202 port 49153 (#0)<br />&gt; * &nbsp; Trying 192.168.1.202...<br />&gt; * connected<br />&gt; * Connected to 192.168.1.202 (192.168.1.202) port 49153 (#0)<br />&gt; &gt; POST /SkyPlay2 HTTP/1.1<br />&gt; &gt; User-Agent: curl/7.27.0<br />&gt; &gt; Host: 192.168.1.202:49153<br />&gt; &gt; Accept: */*<br />&gt; &gt; Content-Type: text/xml<br />&gt; &gt; SOAPACTION: urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI<br />&gt; &gt; Content-Length: 399<br />&gt; &gt;<br />&gt; * upload completely sent off: 399 out of 399 bytes<br />&gt; * additional stuff not fine transfer.c:1037: 0 0<br />&gt; * HTTP 1.1 or later with persistent connection, pipelining supported<br />&gt; &lt; HTTP/1.1 500 Internal Server Error<br />&gt; &lt; CONTENT-LENGTH: 413<br />&gt; &lt; CONTENT-TYPE: text/xml; charset=&quot;utf-8&quot;<br />&gt; &lt; DATE: Sat, 05 Feb 2000 12:25:32 GMT<br />&gt; &lt; EXT:<br />&gt; &lt; SERVER: Linux/2.6.18.8 UPnP/1.0 SKY DLNADOC/1.50<br />&gt; &lt; X-User-Agent: redsonic<br />&gt; &lt;<br />&gt; &lt;s:Envelope xmlns:s=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; <br />&gt; s:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;<br />&gt; &lt;s:Body&gt;<br />&gt; &lt;s:Fault&gt;<br />&gt; &lt;faultcode&gt;s:Client&lt;/faultcode&gt;<br />&gt; &lt;faultstring&gt;UPnPError&lt;/faultstring&gt;<br />&gt; &lt;detail&gt;<br />&gt; &lt;UPnPError xmlns=&quot;urn:schemas-upnp-org:control-1-0&quot;&gt;<br />&gt; &lt;errorCode&gt;-111&lt;/errorCode&gt;<br />&gt; &lt;errorDescription&gt;Invalid Action&lt;/errorDescription&gt;<br />&gt; &lt;/UPnPError&gt;<br />&gt; &lt;/detail&gt;<br />&gt; &lt;/s:Fault&gt;<br />&gt; &lt;/s:Body&gt;<br />&gt; &lt;/s:Envelope&gt;<br />&gt; * Connection #0 to host 192.168.1.202 left intact<br />&gt; * Closing connection #0<br />&gt;<br />&gt; As I said before, this code works fine in firefox poster and correctly <br />&gt; changes the channel (almost instantaneously, much much quicker than my <br />&gt; IR script can do it and much more reliably too! Any help I can get to <br />&gt; get this working will be very gratefully received.<br />&gt;<br />&gt; Regards,<br />&gt;<br />&gt; Dave.<br />&gt;<br />&gt;<br />Try this. &nbsp;You will need to run the script like &quot;scriptname <br />192.168.1.202 ff0&quot;<br /><br /><br />#!/usr/bin/env python<br /><br />import &nbsp;httplib, &nbsp;sys<br /><br />if len(sys.argv) &lt; 3:<br /> &nbsp; &nbsp; sys.exit(&#39;Usage: %s &lt;ipaddress/hostname&gt; &lt;channel&gt; &#39; % sys.argv[0])<br /><br />skyAddress = sys.argv[1]<br />channel = sys.argv[2]<br /><br />conn=httplib.HTTPConnection(&quot;%s:49153&quot; % skyAddress)<br /><br />XML=&quot;&quot;&quot;&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br />&lt;s:Envelope s:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; <br />xmlns:s=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;<br />&lt;s:Body&gt;<br />&lt;u:SetAVTransportURI xmlns:u=&quot;urn:schemas-nds-com:service:SkyPlay:2&quot;&gt;<br />&lt;InstanceID&gt;0&lt;/InstanceID&gt;<br />&lt;CurrentURI&gt;xsi://%s&lt;/CurrentURI&gt;<br />&lt;CurrentURIMetaData&gt;NOT_IMPLEMENTED&lt;/CurrentURIMetaData&gt;<br />&lt;/u:SetAVTransportURI&gt;<br />&lt;/s:Body&gt;<br />&lt;/s:Envelope&gt;&quot;&quot;&quot; % channel<br /><br />headers= &nbsp;{ &quot;Content-Type&quot;: &quot;text/xml&quot;, &quot;SOAPACTION&quot;: <br />&quot;urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI&quot;}<br />conn.request(&quot;POST&quot;, &nbsp;&quot;/SkyPlay2&quot;, &quot;&quot;, &nbsp;headers)<br /><br />conn.send(XML)<br />response= &nbsp;conn.getresponse()<br /><br />print &nbsp;response.status, &nbsp;response.reason<br />print &nbsp;response.read()<br /><br />conn.close()<br /><br />_______________________________________________<br />mythtv-users mailing list<br />mythtv-users@mythtv.org<br />http://www.mythtv.org/mailman/listinfo/mythtv-users<br /></blockquote><p><br />&nbsp;Still no joy, unfortunately, this is what I get when I try that script:</p><p>&nbsp;</p><p>python test 192.168.1.202 ff0</p><p>500 Internal Server Error</p><p>&lt;s:Envelope xmlns:s=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; s:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;</p><p>&lt;s:Body&gt;</p><p>&lt;s:Fault&gt;</p><p>&lt;faultcode&gt;s:Client&lt;/faultcode&gt;</p><p>&lt;faultstring&gt;UPnPError&lt;/faultstring&gt;</p><p>&lt;detail&gt;</p><p>&lt;UPnPError xmlns=&quot;urn:schemas-upnp-org:control-1-0&quot;&gt;</p><p>&lt;errorCode&gt;501&lt;/errorCode&gt;</p><p>&lt;errorDescription&gt;XML error&lt;/errorDescription&gt;</p><p>&lt;/UPnPError&gt;</p><p>&lt;/detail&gt;</p><p>&lt;/s:Fault&gt;</p><p>&lt;/s:Body&gt;</p><p>&lt;/s:Envelope&gt;</p><p>&nbsp;</p><p>regards,</p><p>Dave.</p>
</body>
</html>