Script to get active tv channel

Ideas and dreaming will go this forum

smilykoch
Posts: 13
Joined: Mon Mar 26, 2012 2:22 pm

Script to get active tv channel

Post by smilykoch » Thu Apr 12, 2012 8:18 am

Hey guys..

i currently own a ue40d8005 and im looking for some kind of solution to get info about which active tv channel is being shown on the tv atm.

is this possible? i was thinking some kind of.. perl? script "asking" the tv for the info.. i only need an ID, name or something unique to that single channel..

something like this perhaps: viewtopic.php?f=12&t=1792 but the other way around?

Cheers! Smilykoch

smilykoch
Posts: 13
Joined: Mon Mar 26, 2012 2:22 pm

Re: Script to get active tv channel

Post by smilykoch » Wed Apr 18, 2012 12:47 pm

No-one with knowledge of ANY way to get the active tv channel brought to a computer in some way?
really?

User avatar
erdem_ua
SamyGO Admin
Posts: 3098
Joined: Thu Oct 01, 2009 6:02 am
Location: Istanbul, Turkey
Contact:

Re: Script to get active tv channel

Post by erdem_ua » Sat Apr 21, 2012 9:49 am

I remember that I already asked this question at somewhere...
Do you look at "Debug Menu?" You can find what channel is actually available from here.
But don't know what is http way to do that.

smilykoch
Posts: 13
Joined: Mon Mar 26, 2012 2:22 pm

Re: Script to get active tv channel

Post by smilykoch » Mon May 07, 2012 12:37 pm

Okay.. so i the "debug menu" the currently active channel is showing.. but no current way of bringing this to the PC? either through HTTP, HDMI-CEC or ex-link?

User avatar
juusso
SamyGO Moderator
Posts: 10034
Joined: Sun Mar 07, 2010 6:20 pm

Re: Script to get active tv channel

Post by juusso » Mon May 07, 2012 12:49 pm

Where exact have you got this in top debug menu?
LE40B653T5W,UE40D6750,UE65Q8C
Have questions? Read SamyGO Wiki, Search on forum first!
FFB (v0.8), FFB for CI+ . Get root on: C series, D series, E series, F series, H series. rooting K series, exeDSP/exeTV patches[C/D/E/F/H]

DO NOT EVER INSTALL FIRMWARE UPGRADE

User avatar
erdem_ua
SamyGO Admin
Posts: 3098
Joined: Thu Oct 01, 2009 6:02 am
Location: Istanbul, Turkey
Contact:

Re: Script to get active tv channel

Post by erdem_ua » Tue May 08, 2012 2:05 am

juuso, I don't know where it is but I remember see such an info while playing...

This info at Debug menu, which is only available by ExLink port.
For bridging this info to TV, you can use USB to RS232 based converter...Put USB converter to TV USB port.
Than write a program to detect actual channel on TV (using serial connection to ExLink ) and put it into network (HTTP)..

User avatar
nobody
Posts: 182
Joined: Sat Nov 12, 2011 1:45 am

Re: Script to get active tv channel

Post by nobody » Tue May 08, 2012 3:19 am

What? Debug menu? LOL!

To get the active channel you can simply use UPNP!

GetCurrentMainTVChannel

Code: Select all

<?xml version="1.0" encoding="UTF-8"?><Channel><ChType>DTV</ChType><MajorCh>8</MajorCh><MinorCh>65534</MinorCh><PTC>48</PTC><ProgNum>614</ProgNum></Channel>
You can also use:

GetWatchingInformation

Code: Select all

Only Hits on MTV (03:30AM~05:45AM)
To get the current airing program name (fetched from epg).

Or

GetCurrentProgramInformationURL

Which will return an URL from which you download an XML with cached EPG.

smilykoch
Posts: 13
Joined: Mon Mar 26, 2012 2:22 pm

Re: Script to get active tv channel

Post by smilykoch » Sat May 19, 2012 11:06 am

Plz do explain a little more or give some links to some more info on this :)

i could really use this :)

Eduardo
Posts: 9
Joined: Sat May 19, 2012 4:03 pm

Re: Script to get active tv channel

Post by Eduardo » Sat May 19, 2012 4:17 pm

TVAgent you can get from http://<ip tv>:52235/MainTVServer2/MainTVAgent2.xml

An example:

Code: Select all

#!/usr/bin/perl
# upnp_tv_agent.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__

Code: Select all

$ ./upnp_tv_agent.pl 
[*] <?xml version="1.0" encoding="UTF-8"?><Channel><ChType>DTV</ChType><MajorCh>1</MajorCh><MinorCh>65534</MinorCh><PTC>58</PTC><ProgNum>530</ProgNum></Channel>
[*] Tuner
[*] Tenis - Atp 1000 Roma on La 1 (03:59PM~06:16PM)
Eduardo

smilykoch
Posts: 13
Joined: Mon Mar 26, 2012 2:22 pm

Re: Script to get active tv channel

Post by smilykoch » Sat May 19, 2012 5:40 pm

Cool.. Really! WOW thx!

i can access the XML file through my browser on: http://<ip tv>:52235/MainTVServer2/MainTVAgent2.xml

But it seems kinda empty? it looks like this: http://pastebin.com/jhSzuVSp

I really would like having a script to get it.. but i am not that good at Perl. could you explain your example script?
and would it be possible for me to create it in PHP as i currently have all my other scripts in PHP and i am fairly good at it :)

Cheers
Mathias Koch

Post Reply

Return to “[D] Brainstorm”