Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] cgi2svdrp, program via EPG




Hi,

vdr development is still running fast - great!
If your are working/plan to work on improving html-EPG, you may want to
contact me:

I worked on programming VDR via html-EPG for some time.
I do have some perl scripts that do useful things even if they are quite
simple. Unfortunatly only often, not always :-((, which is why i didn`t
post them here yet. 

* I used Video-Capture-V4l-0.221 to get EPG via bttv (data for more than
a weekn not all networks though)
* I wrote a script to convert these data to a nice html table
* Every row has a link that programs vdr if selected (via cgi2svdrp)
-> * cgi2svdrp: easy connection to vdr from html-page (send every
command, get answer)

Features in work:
* Learn user profile (checkbox input, word statistics, time slot
statistics)
* Sort EPG conviniently (by category, within each: most interesting at
top)

I include cgi2svdrp since it is not too long. Maybe some perl expert has
a look on it.
It needs Perl Modules CGI and Socket.
Change site dependant constants (name of computer running vdr)
Skript should be placed in /usr/local/httpd/cgi-bin (depends on your
distribution)
Use your browser to get the test page via url:
http://<hostname>/cgi-bin/cgi2svrp
Try chan+ chan- first, since they work good.
Main problem: sometimes the connctions hangs and vdr has to be
restarted.
Minor problem: you have to type enough spaces after a command to
overwrite old stuff


Michael

-- Attached file included as plaintext by Listar --
-- File: cgi2svrp

#! /usr/bin/perl -w
# (C) M. Fiegert 10.2000
# This program is free software (GPL). 

# This is a cgi interface to SVRDP of VDR
# It can be called directly to be used interactively or
# from within any html-page with commands like this::
# <td width="15"<p><a href="http://K7/cgi-bin/cgi2svrp?Cmd=newt+1:BR:28:1745:1843:99:99:Die Abendschau:">Set</a></td>

use CGI qw/:standart/;
use Socket qw(:DEFAULT :crlf);    

# --- some site dependant constants
$vdr_port = 2001;
$vdr_host = "K7";

$cmd = "lstt";

# --- html header
print "Content-type: text/html\n\n";
print <<EOT;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head><title>VDR-http</title></head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">

<form name="form" method="get">
<p>Cmd:   <input type="text" name="Cmd" value="help" size="20"></p>
</form>

<form name="form" method="get">
<p>      <input type=submit name="Cmd" value="chan +"></p>
</form>
<form name="form" method="get">
<p>      <input type=submit name="Cmd" value="chan -"></p>
</form>

<PRE>
EOT

# --- Get parameters from http-Request
$query = CGI->new();
$cmd = $query->param('Cmd');

# --- Get connected to VDR
socket(SVRDP,PF_INET,SOCK_STREAM,0) or die "socket: $!";
connect(SVRDP, sockaddr_in($vdr_port,inet_aton($vdr_host)) ) or die "connect: $!";
select (SVRDP); $|=1;  #Needed for unbufferd in- and output!
$line = <SVRDP>;    #Status line after connection
print STDOUT $line."\n";

# --- Send command to VDR and present result
print SVRDP $cmd;

$in ="000-";
while ($in =~ /...-(.*)/)
{
  $in =  <SVRDP>;
  print STDOUT $in."\n";
}

# --- disconnect from VDR
print SVRDP "quit";
$in =  <SVRDP>;
print STDOUT $in;

# --- footer of html page
$time = scalar localtime;
print STDOUT <<EOT;
<b>Date: $time </b>
</PRE>
EOT

print STDOUT "</body></html>\n";



--- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with unsubscribe as subject.



Home | Main Index | Thread Index