#!/usr/bin/perl

my $sat = '';
my $transponder = 0;

while (<>) {
  if (!$sat) {
     if (/1=(\d+)/) {
         $sat = 'S'.  ($1 < 1800 ? $1/10 . 'E' : 180 - ($1 - 1800) / 10 .'W');
     }
  } elsif (!$transponder) {
   if (/\[DVB\]/) { $transponder = 1 } 
  } else {
    s/(\d+)=(\d+),([V|H]),(\d+),(\d+)\s*$/$1:$2:$3:$sat:$4:8191:8191:8191:0:8191:8191:$1:0/ && print "$_\n" 
  }
}
