[mythtv-users] New Sky+ App - control Sky box via tcp/ip network

Dave Pearson lists at the-pearsons.co.uk
Thu Dec 13 14:44:32 UTC 2012


-----Original message-----
From:Michael Watson <michael at thewatsonfamily.id.au>
Sent:Thu 13-12-2012 04:08
Subject:Re: [mythtv-users] New Sky+ App - control Sky box via tcp/ip network
To:Discussion about MythTV <mythtv-users at mythtv.org>; 
On 13/12/2012 1:41 PM, Nick Rout wrote:
>
>
> On Thu, Dec 13, 2012 at 10:29 AM, Dave Pearson 
> <lists at the-pearsons.co.uk <mailto:lists at the-pearsons.co.uk>> wrote:
>
>         -----Original message-----
>         *From:* Raymond Wagner <raymond at wagnerrp.com
>         <mailto:raymond at wagnerrp.com>>
>         *Sent:* Thu 16-08-2012 21:14
>         *Subject:* Re: [mythtv-users] New Sky+ App - control Sky box
>         via tcp/ip network
>         *To:* Discussion about MythTV <mythtv-users at mythtv.org
>         <mailto:mythtv-users at mythtv.org>>;
>         On 8/16/2012 10:38, Dave Pearson wrote:
>         > Before anyone says why don't I do it myself - I'm not clever
>         enough!
>
>         Sure you are, you just don't know you are. Grab a copy of
>         wireshark or
>         tcpdump and have at it. Just start it up, and record the
>         communications
>         between the iPad and the STB as you perform various actions.
>         The only
>         real difficulty would be if they decided it was necessary to
>         perform
>         some kind of authentication between the STB and application,
>         or worse,
>         encrypted the communication.
>         _______________________________________________
>         mythtv-users mailing list
>         mythtv-users at mythtv.org <mailto:mythtv-users at mythtv.org>
>         http://www.mythtv.org/mailman/listinfo/mythtv-users
>
>     OK, I wasn't clever enough to use wireshark to figure out how to
>     send the control commands to my SKY+HD Box, but someone else was
>     (http://www.gladdy.co.uk/blog/2012/08/21/the-skyhd-picasso-dnla-control-server-protocol/)
>     and using the information on that page I have been able to use
>     firefox poster to send a command to change the channel. I'm now
>     trying to take what I'm using in poster to create a bash script
>     that I can use to change the channel in mythtv, unfortunately I'm
>     having no luck with curl at all.
>
>     This is what I'm POSTing using poster:
>
>     headers:
>
>     SOAPACTION: urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI
>
>     content-type: text/xml; charset=utf-8
>
>     body:
>
>     <?xml version="1.0" encoding="utf-8"?>
>
>     <s:Envelope
>     s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>     xmlns:s="http://schemas.smlsoap.org/soap/envelope/">
>
>     <s:Body>
>
>     <u:SetAVTransportURI xmlns:u="urn:schemas-nds-com:service:SkyPlay:2">
>
>     <InstanceID>0</InstanceID>
>
>     <CurrentURI>xsi://ff0</CurrentURI>
>
>     <CurrentURIMetaData>NOT_IMPLEMENTED</CurrentURIMetaData>
>
>     </u:SetAVTransportURI>
>
>     </s:Body>
>
>     </s:Envelope>
>
>     Using the above code in poster I mange to change the channel to
>     ff0, which is the hex code for channel 113 (Universal HD),
>     unfortunately I just cannot figure out how I can get curl to POST
>     the body text (I think the headers are being passed correctly. I'm
>     sure this is really simple, but I'm just stuck! any help will be
>     gratefully received.
>
>     Regards,
>
>     Dave
>
>
> can wget do this?
>
Possibly, but might be easier to use something like python or perl, as 
then end result is going to be a channel change script I guess.
This python code might do the trick.


import  httplib,  urllib
import  re
  
conn=  httplib.HTTPConnection("http://xxx.xxx.xxx.xx  <http://xxx.xxx.xxx.xx/>:49153/SkyPlay2")
XML='*****XMLSTUFF Goes Here *****'
headers=  {  "SOAPACTION: urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI",  "content-type: text/xml", "charset=utf-8"}
conn.request("POST",  params,  "",  headers)
conn.send(XML)
response=  conn.getresponse()
print  response.status,  response.reason
  
print  response.read()
conn.close()



_______________________________________________
mythtv-users mailing list
mythtv-users at mythtv.org
http://www.mythtv.org/mailman/listinfo/mythtv-users

Thanks for your suggestion, unfortunately I don'y know python at all, so cannot really debug where it's going wrong.

Perhaps it might help if I post the curl command that I am using:

 
curl --verbose --header "Content-Type: text/xml" --header "SOAPACTION: urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI" -d @posterbody.xml -X POST http://192.168.1.202:49153/SkyPlay2

 
and the contents of posterbody.xml:

 
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<u:SetAVTransportURI xmlns:u="urn:schemas-nds-com:service:SkyPlay:2">
<InstanceID>0</InstanceID>
<CurrentURI>xsi://ff0</CurrentURI>
<CurrentURIMetaData>NOT_IMPLEMENTED</CurrentURIMetaData>
</u:SetAVTransportURI>
</s:Body>
</s:Envelope>
 
and this is what I get in return:

 
* About to connect() to 192.168.1.202 port 49153 (#0)
*   Trying 192.168.1.202...
* connected
* Connected to 192.168.1.202 (192.168.1.202) port 49153 (#0)
> POST /SkyPlay2 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 192.168.1.202:49153
> Accept: */*
> Content-Type: text/xml
> SOAPACTION: urn:schemas-nds-com:service:SkyPlay:2#SetAVTransportURI
> Content-Length: 399
>
* upload completely sent off: 399 out of 399 bytes
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 500 Internal Server Error
< CONTENT-LENGTH: 413
< CONTENT-TYPE: text/xml; charset="utf-8"
< DATE: Sat, 05 Feb 2000 12:25:32 GMT
< EXT:
< SERVER: Linux/2.6.18.8 UPnP/1.0 SKY DLNADOC/1.50
< X-User-Agent: redsonic
<
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>-111</errorCode>
<errorDescription>Invalid Action</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
* Connection #0 to host 192.168.1.202 left intact
* Closing connection #0
 
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.

 
Regards,

Dave.
 
 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mythtv.org/pipermail/mythtv-users/attachments/20121213/b0f13e7f/attachment.html>


More information about the mythtv-users mailing list