Page 2 of 3
Re: Script to get active tv channel
Posted: Mon May 21, 2012 9:04 am
by smilykoch
Okay.. i tried the perl script on my XAMPP server..
i installed the NET:UPnP module and ran the script with the right perl path in top..
but it returns this error:
Can't call method "postaction" on an undefined value at C:/xampp/htdocs/XBMC/tv.pl line 43. ,
My script looks like this: (just like yours)
Code: Select all
#!"C:\xampp\perl\bin\perl.exe"
# tv.pl
use warnings;
use strict;
use Net::UPnP::ControlPoint;
my $upnp = Net::UPnP::ControlPoint->new();
my @devs = $upnp->search();
my $tv;
foreach my $dev ( @devs )
{
foreach my $serv ( $dev->getservicelist() )
{
if ( $serv->getservicetype() =~ /TVAgent/ )
{
$tv = $serv;
last;
}
}
}
die "TVAgent not found\n" unless $tv;
my $res = action( 'GetCurrentMainTVChannel' );
print "[*] $res->{CurrentChannel}\n";
$res = action( 'GetWatchingInformation' );
print "[*] $res->{TVMode}\n";
print "[*] $res->{WatchingInformation}\n";
exit 0;
# -----------------------------------------------------------------------------
sub action
{
my ( $act, $args ) = @_;
my $r = $tv->postaction( $act, $args );
unless ( 200 == $r->getstatuscode() )
{
die "Error $act: ". $r->getstatuscode()."\n";
}
my $res = $r->getargumentlist();
unless ( 'OK' eq $res->{Result} )
{
die "Error $act response $res->{Result}\n";
}
return $res;
}
# -----------------------------------------------------------------------------
__END__
What is wrong?

Re: Script to get active tv channel
Posted: Mon May 21, 2012 9:28 am
by juusso
On mine D6750 i got another error:
Code: Select all
# ./upnp_tv_agent.pl
TVAgent not found
Dirrect access is impossible too:
Code: Select all
XML Parsing Error: no element found
Location: http://192.168.1.202:52235/MainTVServer2/MainTVAgent2.xml
Line Number 1, Column 1:
I think this works on D7 and D8 series only...
Re: Script to get active tv channel
Posted: Mon May 21, 2012 9:36 am
by smilykoch
That should be no problem as im trying on my ue40d8005..
but i get the above mentioned error :s
Re: Script to get active tv channel
Posted: Mon May 21, 2012 9:43 am
by smilykoch
I made it to the next step!
if i run it through cmd i get this:
c:\xampp\htdocs\XBMC>perl tv.pl
[*] <?xml version="1.0" encoding="UTF-8"?><Channel><ChType>CANALDIGITALSAT</ChType><MajorCh>105</MajorCh><MinorCh>65534</MinorCh><PTC>571</PTC<ProgNum>3206</ProgNum></Channel>
Error GetWatchingInformation response NOTOK
And if i run the .pl script though my browser/webserver (XAMPP) i also get the error:
Error GetWatchingInformation response NOTOK ,
But why?
Re: Script to get active tv channel
Posted: Mon May 21, 2012 10:11 am
by smilykoch
Wooohoo! now it works..
but it seems "kinda" slow? the script takes about 2 seconds from execution to return of values? is this UPnP's fault? or is there a way of decreasing this time?
Thanks
Re: Script to get active tv channel
Posted: Mon May 21, 2012 9:01 pm
by arris69
Eduardo wrote:TVAgent you can get from http://<ip tv>:52235/MainTVServer2/MainTVAgent2.xml
ok, but this is the SCPDURL, from what xml its refered?
looks like not all d-series support this feature?
can you pls make an
and pls. post output?
thnx
arris
Re: Script to get active tv channel
Posted: Mon May 21, 2012 10:59 pm
by Eduardo
It's the same.
smilykoch wrote:... but it seems "kinda" slow? the script takes about 2 seconds from execution to return of values? is this UPnP's fault? or is there a way of decreasing this time?...
UPnP spend a lot of time searching
arris69 wrote:...this is the SCPDURL, from what xml its refered?...
Code: Select all
GET /MainTVServer2/MainTVServer2Desc.xml HTTP/1.0
Host: 192.168.10.224:52235
Content-Length: 0
HTTP/1.1 200 OK
CONTENT-LENGTH: 1217
CONTENT-TYPE: text/xml; charset="utf-8"
DATE: Thu, 01 Jan 1970 00:24:29 GMT
Server: DMRND/0.5
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0" xmlns:sec="http://www.sec.co.kr/dlna">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:samsung.com:device:MainTVServer2:1</deviceType>
<friendlyName>[TV]UE46D7000</friendlyName>
<manufacturer>Samsung Electronics</manufacturer>
<manufacturerURL>http://www.samsung.com/sec</manufacturerURL>
<modelDescription>Samsung TV MainTVServer2</modelDescription>
<modelName>UE46D7000</modelName>
<modelNumber>1.0</modelNumber>
<modelURL>http://www.samsung.com/sec</modelURL>
<serialNumber>20100621</serialNumber>
<UDN>uuid:608fefb9-ba1c-3f12-a968-ddbec4cac48a</UDN>
<UPC>123456789012</UPC>
<sec:deviceID>P7CN4UQJMPT62</sec:deviceID>
<serviceList>
<service>
<serviceType>urn:samsung.com:service:MainTVAgent2:1</serviceType>
<serviceId>urn:samsung.com:serviceId:MainTVAgent2</serviceId>
..<controlURL>/MainTVServer2/control/MainTVAgent2</controlURL>
<eventSubURL>/MainTVServer2/event/MainTVAgent2</eventSubURL>
..<SCPDURL>MainTVAgent2.xml</SCPDURL>
</service>
</serviceList>
</device>
</root>
arris69 wrote:... looks like not all d-series support this feature?
can you pls make an
and pls. post output?...
I'm so sorry, I haven't got root access, I have got an D7000 with firmware 1021

Re: Script to get active tv channel
Posted: Tue May 22, 2012 7:43 am
by setti
On D6500 with Firmware 1014:
Code: Select all
ls -alR /mtd_rwarea/dlna*
/mtd_rwarea/dlna_web_root:
drwxr-xr-x 1 root 0 0 Jan 1 1980 .
drwxr-xr-x 1 root 0 0 Jan 1 1970 ..
-rwxr-xr-x 1 root 0 776 Jan 1 1980 DmrAclConfig.xml
-rwxr-xr-x 1 root 0 931 Jan 1 1980 RcrAclConfig.xml
-rwxr-xr-x 1 root 0 508 Jan 1 1980 RcrMobileList.xml
drwxr-xr-x 1 root 0 0 Jan 1 1980 dmr
drwxr-xr-x 1 root 0 0 Jan 1 1980 rcr
/mtd_rwarea/dlna_web_root/dmr:
drwxr-xr-x 1 root 0 0 Jan 1 1980 .
drwxr-xr-x 1 root 0 0 Jan 1 1980 ..
-rwxr-xr-x 1 root 0 18139 Jan 1 1980 AVTransport1.xml
-rwxr-xr-x 1 root 0 5294 Jan 1 1980 ConnectionManager1.xml
-rwxr-xr-x 1 root 0 9873 Jan 1 1980 RenderingControl1.xml
-rwxr-xr-x 1 root 0 3099 Jan 1 1980 SamsungMRDesc.xml
lrwxr-xr-x 1 root 0 108 Jan 1 1980 icon_LRG.jpg -> /mtd_appdata/Images_960x540/DMR/icon_LRG.jpg
lrwxr-xr-x 1 root 0 108 Jan 1 1980 icon_LRG.png -> /mtd_appdata/Images_960x540/DMR/icon_LRG.png
lrwxr-xr-x 1 root 0 108 Jan 1 1980 icon_SML.jpg -> /mtd_appdata/Images_960x540/DMR/icon_SML.jpg
lrwxr-xr-x 1 root 0 108 Jan 1 1980 icon_SML.png -> /mtd_appdata/Images_960x540/DMR/icon_SML.png
/mtd_rwarea/dlna_web_root/rcr:
drwxr-xr-x 1 root 0 0 Jan 1 1980 .
drwxr-xr-x 1 root 0 0 Jan 1 1980 ..
-rwxr-xr-x 1 root 0 1244 Jan 1 1980 RemoteControlReceiver.xml
-rwxr-xr-x 1 root 0 2787 Jan 1 1980 TestRCRService.xml
Re: Script to get active tv channel
Posted: Tue May 22, 2012 4:41 pm
by smilykoch
I dont have root access on my d8005 either.. sorry :s
Re: Script to get active tv channel
Posted: Wed Jun 06, 2012 7:19 pm
by nobody
Developer Tools for UPnP? Technology
http://opentools.homeip.net/dev-tools-for-upnp
With devicespy you can test around.
And there are also sources.