#!/usr/bin/perl -w

@verzeichnisse = `find /video/ -name *.rec`;

@noad = ('noad', '-v', '--ac3', '--overlap', '--jumplogo', '--comments', '--OSD', '--statisticfile=/var/log/noad.log', 'nice');

# Prüfen, ob noch ein noad-Prozess läuft
$prozesse = `runs "noad "`;
$ret = ($?>>8);
if ($ret == 0 )
{
  print "Es läuft bereits ein noad-Prozess:\n$prozesse";
  print "Abbruch.\n";
  exit;
}

foreach $verz (@verzeichnisse)
{
  chomp ($verz);
  next if -e "$verz/marks.vdr";
  next if -e "$verz/marks";
  system(@noad, $verz);
}
