diff options
Diffstat (limited to 'Tools/schnitt/vdr-remote.pl')
-rwxr-xr-x | Tools/schnitt/vdr-remote.pl | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Tools/schnitt/vdr-remote.pl b/Tools/schnitt/vdr-remote.pl new file mode 100755 index 0000000..32d408e --- /dev/null +++ b/Tools/schnitt/vdr-remote.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w + +use strict; +use Socket; + +my ($dest, $port, $iaddr, $paddr, $proto, $line); + +$dest = "localhost"; +$port = "2001"; + +$iaddr = inet_aton($dest) || Error("no host: $dest"); +$paddr = sockaddr_in($port, $iaddr); + +$proto = getprotobyname('tcp'); +socket(SOCK, PF_INET, SOCK_STREAM, $proto) || Error("socket: $!"); +connect(SOCK, $paddr) || Error("connect: $!"); +select (SOCK); $| = 1; +$a=<SOCK>; + +for (;;) + { + open (FI,"/tmp/vdr-keys"); + while (<FI>) + { + chomp; + print "$_\r\n"; + $a=<SOCK>; + } + close (FI); + } + +print "quit\r\n"; +$a=<SOCK>; +close (SOCK) || Error("close: $!"); + +sub Error +{ + print STDERR "@_\n"; + exit 0; +} |