diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-12-04 14:36:37 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-12-04 14:36:37 +0100 |
commit | a6138160501bf5c1bf42c5f16c6d0333d7b31e9d (patch) | |
tree | 870e36154dd657a3c081717f95ca32547fa78e17 /epg2html.pl | |
parent | 7ab9d4fcfdc847131d0c46a5e3923ae0f0492fdf (diff) | |
download | vdr-a6138160501bf5c1bf42c5f16c6d0333d7b31e9d.tar.gz vdr-a6138160501bf5c1bf42c5f16c6d0333d7b31e9d.tar.bz2 |
Removed the '.pl' suffix from all scripts
Diffstat (limited to 'epg2html.pl')
-rwxr-xr-x | epg2html.pl | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/epg2html.pl b/epg2html.pl deleted file mode 100755 index a18ec08b..00000000 --- a/epg2html.pl +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/perl - -# A simple EPG to HTML converter -# -# Converts the EPG data written by 'vdr' into the file /video/epg.data -# into a simple HTML programme listing, consisting of one file per channel -# plus an 'index.htm' file. All output files are written into the current -# directory. -# -# Usage: epg2html.pl < /video/epg.data -# -# See the main source file 'vdr.c' for copyright information and -# how to reach the author. -# -# $Id: epg2html.pl 1.7 2006/04/17 12:19:08 kls Exp $ - -@Index = (); - -sub GetDay -{ - return substr(localtime(shift), 0, 10); -} - -sub GetTime -{ - return substr(localtime(shift), 11, 5); -} - -sub Tags -{ - my $s = shift; - $s =~ s/\&/&/g; - $s =~ s/</</g; - $s =~ s/>/>/g; - return $s; -} - -while (<>) { - chomp; - if (/^C ([^ ]+) *(.*)/) { - my $Channel = $2; - (my $Page = $Channel) =~ y/\/ /-_/; - $Page .= ".htm"; - $Channel = Tags($Channel); - push(@Index, qq{<a href="$Page">$Channel</a><br>\n}); - my %Events = (); - while (<>) { - if (/^E (.*?) (.*?) ([^ ]*)/) { - (my $Time, $Duration) = ($2, $3); - my $Title = "", $Subtitle = "", $Description = "", $Vps = 0; - while (<>) { - if (/^T (.*)/) { $Title = Tags($1); } - elsif (/^S (.*)/) { $Subtitle = Tags($1); } - elsif (/^D (.*)/) { $Description = Tags($1); $Description =~ s/\|/<br>/g; } - elsif (/^V (.*)/) { $Vps = $1; } - elsif (/^e/) { - $Events{$Time} = [($Duration, $Title, $Subtitle, $Description, $Vps)]; - last; - } - } - } - elsif (/^c/) { - my @Schedule = (); - my $Day = ""; - for $t (sort keys %Events) { - (my $Duration, $Title, $Subtitle, $Description, $Vps) = @{$Events{$t}}; - my $d = GetDay($t); - if ($d ne $Day) { - push(@Schedule, "</table>\n") if ($Day && @Schedule); - push(@Schedule, "<h2>$d</h2>\n"); - push(@Schedule, "<table cellspacing=2>\n"); - $Day = $d; - } - my $Entry = $Title; - $Entry .= "<br><i>$Subtitle</i>" if $Subtitle; - $Entry .= "<br>$Description" if $Description; - $Entry .= "<br>(VPS = " . scalar localtime($Vps) . ")" if $Vps && $Vps != $t; - push(@Schedule, "<tr><td valign=top>" . GetTime($t) . "</td><td>$Entry</td></tr>\n"); - } - push(@Schedule, "</table>\n") if (@Schedule); - open(PAGE, ">$Page") or die "$Page: $!\n"; - print PAGE "<html>\n<head><title>$Channel</title><head>\n<body>\n"; - print PAGE "<h1>$Channel</h1>\n"; - print PAGE @Schedule; - print PAGE "</body>\n</html>\n"; - close(PAGE); - last; - } - } - } - } - -open(INDEX, ">index.htm") or die "index.htm: $!\n"; -print INDEX "<html>\n<head><title>EPG Index</title><head>\n<body>\n"; -print INDEX sort { lc($a) cmp lc($b) } @Index; -print INDEX "</body>\n</html>\n"; -close(INDEX); |