#!/usr/bin/perl
# D. Schroeder 2005
# www.zabex.de

# Prueft, ob es was neues in Fingers Forum gibt...

use     LWP::Simple;
require LWP::Protocol::file;

#----------------------------------------
$langsam=60*10;
$schnell=120;
$anzahlSchnell=8;
#----------------------------------------
$zeit=$schnell;
$n=0;
$reftime='';
while(1){
  do{
    system "color 79" if $zeit == $schnell;
    system "color 70" if $zeit == $langsam;
    system "cls";
    system "time /t";
    sleep($zeit) unless $reftime eq '';
    if ($zeit == $schnell){
      $n++;
      if ($n>$anzahlSchnell){
        $n=0;
        $zeit=$langsam;
      }
    }
    
    $newtime='';
    #---Seite holen und analysieren
    foreach $_ (split(/<\/tr>/,get("http://f3.webmart.de/f.cfm?id=1663923&d=1"))){
      #print "$_\n\n\n";
      if (/tabindex=\"\d+\"\>\s+(.+?)\<\/a\>/ms){
        $titel=$1;
      }  
      if (/(\d{2})\.(\d{2})\.(\d{2})\s(\d{2})\:(\d{2})/){
        $time="20$3.$2.$1 $4:$5";
        if ($time gt $newtime){
          $newtime=$time;
          $newtitel=$titel;
        }
      }
    }
    #---
  }while ($newtime eq $reftime);    
  system "color CE";
  print "****************************************************************\n";
  print "$newtime $newtitel\n";
  print "****************************************************************\n";
  $reftime=$newtime;
  $newtitel="";
  
  getc;  #Diese Zeile entfernen, damit nicht auf Eingabetaste gewartet wird.
  system 'start firefox.exe "http://f3.webmart.de/f.cfm?id=1663923&d=1"';  #Hier ggf. Opera eintragen. IE besser nicht ;-)
  $zeit = $schnell;
}
#EOF

