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