summaryrefslogtreecommitdiff
path: root/summary2info.pl
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2005-05-16 14:45:11 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2005-05-16 14:45:11 +0200
commitb0583e5373e10119fd88d935cdded1e153101e22 (patch)
tree2281fe1f09492c8a528e48356571776ec7401324 /summary2info.pl
parent6e274dfeef1987bebfa2d662fc40e03bbad4951f (diff)
downloadvdr-b0583e5373e10119fd88d935cdded1e153101e22.tar.gz
vdr-b0583e5373e10119fd88d935cdded1e153101e22.tar.bz2
Switched from 'summary.vdr' to 'info.vdr'
Diffstat (limited to 'summary2info.pl')
-rwxr-xr-xsummary2info.pl47
1 files changed, 47 insertions, 0 deletions
diff --git a/summary2info.pl b/summary2info.pl
new file mode 100755
index 00000000..4bf70624
--- /dev/null
+++ b/summary2info.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+
+# Convert 'summary.vdr' files to 'info.vdr'
+#
+# Converts all 'summary.vdr' files in the video directory to the
+# 'info.vdr' format as used from VDR version 1.3.25 upward.
+#
+# Usage: summary2info.pl /video
+#
+# See the main source file 'vdr.c' for copyright information and
+# how to reach the author.
+#
+# $Id: summary2info.pl 1.1 2005/05/15 16:03:10 kls Exp $
+
+$VideoDir = $ARGV[0] || die "please provide the name of the video directory\n";
+
+@SummaryFiles = `find "$VideoDir" -name summary.vdr`;
+
+for $SummaryFile (@SummaryFiles) {
+ chomp($SummaryFile);
+ print STDERR "converting $SummaryFile...";
+ open(F, $SummaryFile) || die "$SummaryFile: $!\n";
+ $line = 0;
+ @data = ();
+ while (<F>) {
+ chomp;
+ if ($_) {
+ $data[$line] .= '|' if ($data[$line]);
+ $data[$line] .= $_;
+ }
+ else {
+ $line++ unless ($_);
+ }
+ }
+ close(F);
+ if ($line == 1) {
+ $data[2] = $data[1];
+ $data[1] = "";
+ }
+ ($InfoFile = $SummaryFile) =~ s/summary\.vdr$/info.vdr/;
+ open(F, ">$InfoFile") || die "$InfoFile: $!\n";
+ print F "T $data[0]\n" if ($data[0]);
+ print F "S $data[1]\n" if ($data[1]);
+ print F "D $data[2]\n" if ($data[2]);
+ close(F);
+ print STDERR "done.\n";
+ }