#!/usr/bin/perl -w # vim:ft=perl: # (C) 2003, 2004 Christoph Berg GNU GPL. use strict; my ($titel, $station, $datum, $zeit, $laenge); if($ARGV[0]) { get_info($ARGV[0]); print "v4l-record -s $station -t $zeit -l $laenge -o $titel-$datum-$zeit-$station.avi\n"; exit(0); } while(<>) { print; $titel = $1 if /Titel: '(.*)'/; ($datum, $station) = ($1, $2) if /, (\d\d\.\d\d)\. (.+)/; if(/^(http:.*)/) { my $headline = <>; print $headline; next if $headline =~ /picket fences/i; # auch ein Tatort get_info($1); print "v4l-record -s $station -t $zeit -l $laenge -o $titel-$datum-$zeit-$station.avi\n"; } } sub get_info { my $url = shift; open W, "wget -q -O - '$url' |" or die "wget: $!"; while() { last if /Merkzettel anzeigen|Jetzt kostenlos anmelden/; } print "\n"; while() { s/<.*?>/ /g; s/ / /g; s/[ \t\r]+/ /g; s/^ | $//g; next if /« zurück|Eigene Auswahl aus Einzelsendungen|Sendungsinformation|mehr Bilder|SMS-Reminder/; last if /Als TV-Tipp per E-Mail an Freunde verschicken/; print " $_" if $_ ne "\n"; #22:30 - 00:00 Uhr if(/(\d\d):(\d\d) - (\d\d):(\d\d) Uhr/) { $zeit = "$1:$2"; $laenge = 25*60 * (60*$3 + $4 - 60*$1 - $2 + 5); } } close W; print "\n"; }