summaryrefslogtreecommitdiff
path: root/summary2info
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-12-04 14:36:37 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2011-12-04 14:36:37 +0100
commita6138160501bf5c1bf42c5f16c6d0333d7b31e9d (patch)
tree870e36154dd657a3c081717f95ca32547fa78e17 /summary2info
parent7ab9d4fcfdc847131d0c46a5e3923ae0f0492fdf (diff)
downloadvdr-a6138160501bf5c1bf42c5f16c6d0333d7b31e9d.tar.gz
vdr-a6138160501bf5c1bf42c5f16c6d0333d7b31e9d.tar.bz2
Removed the '.pl' suffix from all scripts
Diffstat (limited to 'summary2info')
-rwxr-xr-xsummary2info56
1 files changed, 56 insertions, 0 deletions
diff --git a/summary2info b/summary2info
new file mode 100755
index 00000000..fc633f92
--- /dev/null
+++ b/summary2info
@@ -0,0 +1,56 @@
+#!/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 /video
+#
+# See the main source file 'vdr.c' for copyright information and
+# how to reach the author.
+#
+# $Id: summary2info 2.1 2011/12/04 14:17:35 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 ($_ || $line > 1) {
+ $data[$line] .= '|' if ($data[$line]);
+ $data[$line] .= $_;
+ }
+ else {
+ $line++;
+ }
+ }
+ close(F);
+ if (!$data[2]) {
+ $data[2] = $data[1];
+ $data[1] = "";
+ }
+ elsif ($data[1] && $data[2]) {
+ # if line 1 is too long, it can't be the short text,
+ # so assume the short text is missing and concatenate
+ # line 1 and line 2 to be the long text:
+ if (length($data[1]) > 80) {
+ $data[2] = $data[1] . "|" . $data[2];
+ $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";
+ }