summaryrefslogtreecommitdiff
path: root/Tools/schnitt
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/schnitt')
-rw-r--r--Tools/schnitt/README84
-rwxr-xr-xTools/schnitt/cut.pl40
-rwxr-xr-xTools/schnitt/cut22
-rwxr-xr-xTools/schnitt/cutall4
-rwxr-xr-xTools/schnitt/cutall25
-rwxr-xr-xTools/schnitt/cutt85
-rwxr-xr-xTools/schnitt/getpreviframe.pl31
-rw-r--r--Tools/schnitt/index.php215
-rwxr-xr-xTools/schnitt/lmplex51
-rwxr-xr-xTools/schnitt/mv223
-rwxr-xr-xTools/schnitt/schnitt.pl26
-rwxr-xr-xTools/schnitt/schnitt2.pl91
-rwxr-xr-xTools/schnitt/schnitt3.pl64
-rwxr-xr-xTools/schnitt/schnitt3.pl.new77
-rwxr-xr-xTools/schnitt/schnitt4.pl13
-rwxr-xr-xTools/schnitt/schnitt5.pl16
-rwxr-xr-xTools/schnitt/schnitt6.pl30
-rwxr-xr-xTools/schnitt/schnittcommon.pli64
-rwxr-xr-xTools/schnitt/show11
-rwxr-xr-xTools/schnitt/unsort25
-rwxr-xr-xTools/schnitt/vdr-remote.pl40
-rwxr-xr-xTools/schnitt/vdr22
-rwxr-xr-xTools/schnitt/vmount18
23 files changed, 1017 insertions, 0 deletions
diff --git a/Tools/schnitt/README b/Tools/schnitt/README
new file mode 100644
index 0000000..29953e0
--- /dev/null
+++ b/Tools/schnitt/README
@@ -0,0 +1,84 @@
+ Sammlung von "Hilfs"-Scripten
+
+Diese Sammlung an "Hilfs"-Scripten habe ich mir zum scheiden und anderen
+Zwecken zusammengeschrieben.
+
+Das ganze unterliegt natuerlich der GPL.
+
+Ich bin nicht sonderlich gut im "Dokumentieren". Also gilt die Devise
+"Hilf dir selbst".
+
+Ein paar Worte zu den "Hart"-Codierten Pfaden.
+
+/yele/video (/video/video0)
+/yelg/video (/video/video1)
+
+Sind die 2 Pfade auf meinem DVB-Rechner
+
+/x1/video
+
+Ist das Verzeichniss in das die Video zum schneiden verschoben werden.
+
+/x1/temp
+/x2/temp
+
+Sind die beim schneiden verwendeten Temporaer-Verzeichnisse
+
+
+Enthalten sind folgende Scripte:
+
+cutall -> "Master"-Script zum starten des Scheide vorgangs.
+ Ist ein "find" nach "cut" -Dateien
+cutt -> Das "eigentliche" Schnitt-Script
+ Scheidet die Stuecke aus, demultipext, remultipext,
+ splitted die Dateien und macht am Ende ein
+ ISO-Image daraus
+index.php -> PHP-Script zum finden der Schnitt-Punkte, mit
+ Testmoeglichkeit ob erfolgreich an diesem Punkt
+ geschnitten werden kann
+mv2 -> Zum Moven der Aufnahmen von meinem DVB-Rechner
+ auf mein "Arbeitsrechner"
+schnitt.pl -> Extraiert ein einzelnes Bild um es anzuzeigen
+ (Fuer index.php)
+schnitt2.pl -> Gibt alles zwischen 2 Schnittpunkten auf STDOUT aus
+schnitt3.pl -> Testet ob erfolgreich geschnitten werden kann.
+schnitt3.pl.new -> Version fuer PES-Datenstroeme
+schnitt4.pl -> "Beschleunigtes" Schnitt-Programm fuer VIVA
+ aufnahmen. 1 "VIDEO" pro Zeile erzeugt
+ "a", "b" ... Dateien
+schnitt5.pl -> Gibt Datei-Nummern von einer Schnittmarke
+ +- 15000 Frames aus
+schnitt6.pl -> Loescht alle Dateien die nicht von in einer von
+ schnitt5.pl abgedeckt ist. (Damit mv2 nicht so
+ lange braucht)
+show -> Wird auf einem X-Display gestartet und zeigt das
+ aktuelle Bild von "schnitt.pl" an
+vdr-remote.pl -> "Skeleton" um ueber SVDR-Kommandos zu schicken
+vdr2 -> Start-Script
+vmount -> Mounten aller zusammengehoeriger ISO-Images zum
+ abspielen
+
+Hilsscripte:
+------------
+cut.pl -> Entspricht weitestgehend "split" aber mit
+ "Nummer" anstatt Buchstaben
+cut2 -> Entfernt escapende Backslashes
+cutall2 -> Springt ins Schnitt-Verzeichniss und ruft das
+ "eigentliche" Schnitt-Script auf
+lmplex -> Multiplexed Datenstrome unter Zurhilfename
+ saemtlicher CPUs
+schnittcommon.pli -> Das "Common" Script fuer schnitt?.pl
+getpreviframe.pl -> Findet das vorherige I-Frame.
+unsort -> Macht das Gegenteil von sort.
+
+
+Die ganze "Schnittloesung" ist leider etwas "unbrauchbar", weil ich aus
+Unachtsamkeit leider die gepatchten Sourcen von 2 wichtigen Programm
+geloescht habe.
+
+dumpfrage -> Extraiert das erste Frage in eine Datei zum
+ anzeigen (gepatchtes dump aus "libmpeg3"
+pvademux -> gepatcht um eine Pfad-Angabe
+
+Entweder macht jemand/ich patchen "nochmal" oder ich kann auch die
+Binaries zur Verfuegung stellen.
diff --git a/Tools/schnitt/cut.pl b/Tools/schnitt/cut.pl
new file mode 100755
index 0000000..dd62c18
--- /dev/null
+++ b/Tools/schnitt/cut.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $maxsize = 660 * 1024 * 1024;
+
+my $read = 1024*1024;
+my $size = 1024*1024;
+
+my $filenum = "1";
+my $count = 0;
+
+my ($fi,$data);
+
+$fi = sprintf ("part%d",$filenum);
+open (FI,">$fi");
+
+while ($read == $size)
+ {
+ if ($count < $maxsize)
+ {
+ $read = read (STDIN,$data,$size);
+ print FI $data;
+ $count += $size;
+ $a = $count /1024/1024;
+ if ($a % 10 == 0) {
+ print STDERR "File: $filenum Size: ${a}MB\n";
+ }
+ }
+ else
+ {
+ close (FI);
+ $filenum++;
+ $fi = sprintf ("part%d",$filenum);
+ open (FI,">$fi");
+ $count = 0;
+ }
+ }
+
+close FI;
diff --git a/Tools/schnitt/cut2 b/Tools/schnitt/cut2
new file mode 100755
index 0000000..0193ac0
--- /dev/null
+++ b/Tools/schnitt/cut2
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat cut | head -n 1 | tr -d [\\\\]
diff --git a/Tools/schnitt/cutall b/Tools/schnitt/cutall
new file mode 100755
index 0000000..355935f
--- /dev/null
+++ b/Tools/schnitt/cutall
@@ -0,0 +1,4 @@
+#!/bin/sh
+cutdir=/x1/video/
+
+find $cutdir -name "cut" -exec cutall2 {} \;
diff --git a/Tools/schnitt/cutall2 b/Tools/schnitt/cutall2
new file mode 100755
index 0000000..90b0f46
--- /dev/null
+++ b/Tools/schnitt/cutall2
@@ -0,0 +1,5 @@
+#!/bin/sh
+a=`echo $1 | cut -d / -f1-5`
+cd $a
+cutt
+mv cut cut.bak
diff --git a/Tools/schnitt/cutt b/Tools/schnitt/cutt
new file mode 100755
index 0000000..4e89b7a
--- /dev/null
+++ b/Tools/schnitt/cutt
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+DIRA=/x2/temp
+DIRB=/x1/temp
+
+if [ -f cut ]; then
+ name="`cut2`"
+ echo $name
+ count=`cat cut | wc -l`
+ let count=count-1
+ let test=count%2
+ if [ "$test" == "1" ]; then
+ echo Ungerade Anzahl von Markierungen
+ exit 1
+ fi
+
+ file=1
+
+ while [ "$count" != "0" ]
+ do
+ start=`cat cut | tail -n $count | head -n 1`
+ let count=count-1
+ end=`cat cut | tail -n $count | head -n 1`
+ let count=count-1
+ echo Cutting\&Demuxing from $start to $end
+ schnitt2.pl $start $end | pvademux $DIRA teil$file
+# schnitt2.pl $start $end | pes2av_pes | pvademux $DIRA teil$file
+ let file=file+1
+ done
+else
+ echo Keine Beschreibungsdatei
+ exit 1
+fi
+
+# Ab hier mkimg
+
+sync
+
+lmplex $DIRA $DIRB `ls -la $DIRA/teil*.m2v | cut -b 30- | sort -n -r | cut -d / -f4`
+
+echo Multiplexing DONE
+
+rm -f $DIRA/teil*.m2v $DIRA/teil*.mp2
+
+sync
+
+if [ -f $DIRB/teil1.mpg ]; then
+ echo Splitting
+ cd $DIRA
+# cat $DIRB/teil*.mpg | split -b 723517440
+ cat $DIRB/teil*.mpg | cut.pl
+ rm $DIRB/teil*
+fi
+
+sync
+
+cd $DIRA
+
+if [ -f part2 ]; then
+ count=1
+ cond=0
+
+ while [ "$cond" != "1" ]
+ do
+ mkdir a
+ mv "part$count" "a/${name} Teil $count"
+ echo mkisofs Teil $count
+ mkisofs -r -o $DIRB/image1.raw a
+ rm -rf a
+ mv -- $DIRB/image1.raw "$DIRB/${name} Teil $count"
+ sync
+
+ let count=count+1
+ if [ ! -f "part$count" ]; then
+ cond=1
+ fi
+ done
+else
+ mkdir a
+ mv part1 "a/${name}"
+ echo mkisofs
+ mkisofs -r -o $DIRB/image1.raw a
+ rm -rf a
+ mv -- $DIRB/image1.raw "$DIRB/${name}"
+fi
diff --git a/Tools/schnitt/getpreviframe.pl b/Tools/schnitt/getpreviframe.pl
new file mode 100755
index 0000000..6774f31
--- /dev/null
+++ b/Tools/schnitt/getpreviframe.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use strict;
+
+my ($index, $oindex);
+
+require "/usr/local/bin/my/schnittcommon.pli";
+
+if (!open (INDEX,"index.vdr"))
+ {
+ exit 1;
+ }
+
+$index = $oindex = $ARGV[0];
+
+if ($index > 0)
+{
+ &prevI;
+ if ($oindex != $index)
+ {
+ print "$index\n";
+ }
+ else
+ {
+ print "$oindex\n";
+ }
+}
+else
+{
+ print "0\n";
+}
diff --git a/Tools/schnitt/index.php b/Tools/schnitt/index.php
new file mode 100644
index 0000000..58a288f
--- /dev/null
+++ b/Tools/schnitt/index.php
@@ -0,0 +1,215 @@
+<html>
+<head>
+ <title>Schneiden</title>
+</head>
+<body bgcolor=#C0C0C0>
+<?
+if ($level == 0)
+ {
+ $dircount=0;
+ $handle=opendir('/x1/video');
+ while ($file = readdir($handle)) {
+ if ($file != "." && $file != ".." && $file != "epg.data") {
+ $dir=$file;
+ $dircount++;
+ }
+ }
+ if ($dircount == 1) {
+ $level=1;
+ }
+ else
+ {
+?>
+<center><h1>Sender</h1></center>
+<form action="index.php" method="post">
+<input type=hidden name=level value="1">
+<?
+ $handle=opendir('/x1/video');
+ while ($file = readdir($handle)) {
+ if ($file != "." && $file != ".." && $file != "epg.data") {
+ echo "<input type=submit name=dir value=\"$file\">\n";
+ }
+ }
+ closedir($handle);
+?>
+</form>
+<?
+ }
+ }
+if ($level == 1)
+ {
+ $dircount=0;
+ $handle=opendir("/x1/video/$dir");
+ while ($file = readdir($handle)) {
+ if ($file != "." && $file != "..") {
+ $dira="$dir/$file";
+ $dircount++;
+ }
+ }
+ if ($dircount == 1) {
+ $dir = $dira;
+ $level = 2;
+ }
+ else
+ {
+?>
+<form action="index.php" method="post">
+<input type=hidden name=level value="2">
+<?
+ echo "<center><h1>Filme/Serien fuer den Sender $dir</h1></center>";
+ $handle=opendir("/x1/video/$dir");
+ while ($file = readdir($handle)) {
+ if ($file != "." && $file != "..") {
+ echo "<input type=submit name=dir value=\"$dir/$file\"><br>\n";
+ }
+ }
+ closedir($handle);
+?>
+</form>
+<?
+ }
+ }
+if ($level == 2)
+ {
+if ($aindex)
+ $index = $aindex;
+else if (!$index)
+ $index = 0;
+
+if ($dir)
+ chdir ("/x1/video/$dir");
+
+switch ($cindex) {
+ case "-10000":
+ if ($index >=10000)
+ $index -= 10000;
+ break;
+ case "-4000":
+ if ($index >=4000)
+ $index -= 4000;
+ break;
+ case "-2000":
+ if ($index >=2000)
+ $index -= 2000;
+ break;
+ case "-1000":
+ if ($index >=1000)
+ $index -= 1000;
+ break;
+ case "-500":
+ if ($index >=500)
+ $index -= 500;
+ break;
+ case "-100":
+ if ($index >=100)
+ $index -= 100;
+ break;
+ case "Vorheriges I-Frame":
+ $pindex = $index - 1;
+ $fp = popen ("/usr/local/bin/my/getpreviframe.pl $pindex","r");
+ $i = fgets($fp,1000);
+ $index = chop ($i);
+ pclose ($fp);
+ break;
+ case "Naechstes I-Frame":
+ $index ++;
+ break;
+ case "+100":
+ $index += 100;
+ break;
+ case "+500":
+ $index += 500;
+ break;
+ case "+1000":
+ $index += 1000;
+ break;
+ case "+2000":
+ $index += 2000;
+ break;
+ case "+4000":
+ $index += 4000;
+ break;
+ case "+10000":
+ $index += 10000;
+ break;
+ }
+
+if ($test)
+ {
+ $fp = popen ("/usr/local/bin/my/schnitt3.pl $index","r");
+ $i = fgets($fp,1000);
+ pclose ($fp);
+ $index = chop ($i);
+ }
+
+if ($name)
+ {
+ $fp = fopen ("cut","w");
+ fputs ($fp,"$name\n");
+ fclose ($fp);
+ }
+
+if ($cut)
+ {
+ $fp = fopen ("cut","a");
+ fputs ($fp,"$index\n");
+ fclose ($fp);
+ }
+
+$fp = popen ("/usr/local/bin/my/schnitt.pl $index","r");
+$i = fgets($fp,1000);
+pclose ($fp);
+$index = chop ($i);
+
+system ("/usr/local/bin/my/dumpframe /x2/temp/bild.m2v");
+system ("mv output.ppm /x2/temp");
+system ("touch /x2/temp/newpic");
+system ("killall sleep");
+?>
+<form action="index.php" method="post">
+<input type=hidden name=level value="2">
+<input type=hidden name=dir value="<?=$dir?>">
+<input type=hidden name=index value=<?=$index?>>
+<table width=90% align=center>
+<tr>
+<td><h1>Index <?=$index?></h1></td>
+<td><h1>Dir: <?=$dir?></h1></td>
+</tr>
+</table>
+<table width=80% align=center>
+<tr>
+<td><input type=submit name=cindex value="-10000"></td>
+<td><input type=submit name=cindex value="-4000"></td>
+<td><input type=submit name=cindex value="-2000"></td>
+<td><input type=submit name=cindex value="-1000"></td>
+<td><input type=submit name=cindex value="-500"></td>
+<td><input type=submit name=cindex value="-100"></td>
+<td><input type=submit name=cindex value="Vorheriges I-Frame"></td>
+<td><input type=submit name=cindex value="Naechstes I-Frame"</td>
+<td><input type=submit name=cindex value="+100"></td>
+<td><input type=submit name=cindex value="+500"></td>
+<td><input type=submit name=cindex value="+1000"></td>
+<td><input type=submit name=cindex value="+2000"></td>
+<td><input type=submit name=cindex value="+4000"></td>
+<td><input type=submit name=cindex value="+10000"></td>
+</tr>
+</table>
+<table>
+<tr>
+<td>Absoluter Index: <input type=text name=aindex size=6></td>
+<td><input type=submit name=test value="Schnitt-Test"></td>
+<td><input type=submit name=cut value="Mark"></td>
+</form>
+<form action="index.php" method="post">
+<input type=hidden name=level value="2">
+<input type=hidden name=dir value="<?=$dir?>">
+<input type=hidden name=index value=<?=$index?>>
+<td>Titel: <input type=text name=name size=50 maxlength=255></td>
+</form>
+</tr>
+</table>
+<?
+}
+?>
+</body>
+</html>
diff --git a/Tools/schnitt/lmplex b/Tools/schnitt/lmplex
new file mode 100755
index 0000000..8cbb50f
--- /dev/null
+++ b/Tools/schnitt/lmplex
@@ -0,0 +1,51 @@
+#! /usr/bin/perl
+
+### Calculate the number of CPUs we want to keep busy
+open IN, "/proc/cpuinfo";
+$cpus = grep /processor.*:/, <IN>;
+close IN;
+
+### This is a list of files to encode
+@names = @ARGV;
+
+$dira = shift @names;
+$dirb = shift @names;
+
+### This is the name of the encoder to use.
+$coder = "/usr/local/bin/mplex ";
+###
+
+###
+###
+###
+
+# Encode a single file
+sub do_one {
+ my($m2v) = shift;
+ # Make mp3 from wav
+ $m2v =~ s/\.m2v$//;
+
+ # In a subprocess, encode the file
+ printf "Multiplexing ${m2v}\n";
+ unless($pid = fork) {
+ system ("$coder ${dira}/${m2v}.m2v ${dira}/${m2v}.mp2 ${dirb}/${m2v}.mpg");
+ exit;
+ }
+}
+
+# Go ahead and prefork $cpus encoders
+foreach $i (0 .. $cpus-1) {
+ &do_one($names[0]) if ($names[0] ne "");
+ shift @names;
+}
+
+# Wait for the end of each encoder, start a new one...
+foreach $i (@names) {
+ wait;
+ &do_one($i);
+}
+
+# Wait for everything to close down.
+while(wait > 0) {
+ ;
+}
diff --git a/Tools/schnitt/mv2 b/Tools/schnitt/mv2
new file mode 100755
index 0000000..a0cefba
--- /dev/null
+++ b/Tools/schnitt/mv2
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+DIR = /x1/video
+
+if [ ! "$UID" = 0 ]; then
+ if [ -d "$1" ]; then
+ cd $DIR
+ a=`echo "$1" | cut -d / -f4-`
+ mkdir -p "$a"
+ cd "$a"
+ (echo cd "$1"; echo mget \*)| ftp -i dvb
+ cd $DIR
+ ls -Ls $1 > /tmp/yele
+ ls -Ls $a > /tmp/x1
+ a=`echo "$1" | cut -d \/ -f3-`
+ diff -u /tmp/yele /tmp/x1 &> /dev/null && rm -rfv /yel?/$a
+ rm /tmp/yele
+ rm /tmp/x1
+ rmdir /yel?/video/*
+ fi
+else
+ echo Not as root
+fi
diff --git a/Tools/schnitt/schnitt.pl b/Tools/schnitt/schnitt.pl
new file mode 100755
index 0000000..d5521eb
--- /dev/null
+++ b/Tools/schnitt/schnitt.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+require "/usr/local/bin/my/schnittcommon.pli";
+
+if (!open (INDEX,"index.vdr"))
+ {
+ exit 1;
+ }
+$index = $ARGV[0];
+&nextI;
+$offset1 = $offset;
+&readnext;
+$off = $offset - $offset1;
+close (FI);
+$fi = sprintf ("%03d.vdr",$file);
+open (FI,$fi);
+open (FO,">bild");
+sysseek (FI,$offset1,0);
+sysread (FI,$temp,200000);
+syswrite (FO,$temp,200000);
+close (FI);
+close (FO);
+
+`/usr/local/bin/pvademux.old /x2/temp bild`;
+#`/usr/local/bin/pes2av_pes bild | /usr/local/bin/pvademux /x2/temp bild`;
+print "$index\n";
diff --git a/Tools/schnitt/schnitt2.pl b/Tools/schnitt/schnitt2.pl
new file mode 100755
index 0000000..e52b245
--- /dev/null
+++ b/Tools/schnitt/schnitt2.pl
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+
+require "/usr/local/bin/my/schnittcommon.pli";
+
+if (!open (INDEX,"index.vdr"))
+ {
+ print "Error opening index.vdr";
+ exit 1;
+ }
+
+$index = $ARGV[0];
+&nextI;
+$file1 = $file;
+$offset1 = $offset;
+$index = $ARGV[1];
+&nextI;
+$file2 = $file;
+$offset2 = $offset;
+
+if ($file1 == $file2)
+ {
+ $count = $offset2 - $offset1;
+ $cond = 0;
+ $size = 1024*1024;
+ $fi = sprintf ("%03d.vdr",$file);
+ open (FI,$fi);
+ sysseek (FI,$offset1,0);
+ while ($cond == 0)
+ {
+ if ($count > $size)
+ {
+ $read = sysread (FI,$data,$size);
+ print $data;
+ $count -= $size;
+ }
+ else
+ {
+ $read = sysread (FI,$data,$count);
+ print $data;
+ $cond = 1;
+ }
+ }
+ }
+else
+ {
+ $count = $offset2;
+ $cond = 0;
+ $read = $size = 1024*1024;
+ $fi = sprintf ("%03d.vdr",$file1);
+ open (FI,$fi);
+ sysseek (FI,$offset1,0);
+ while ($read == $size)
+ {
+ $read = sysread (FI,$data,$size);
+ print $data;
+ }
+ close (FI);
+
+ $file1++;
+ while ($file1 != $file2)
+ {
+ $fi = sprintf ("%03d.vdr",$file1);
+ open (FI,$fi);
+ $read = 1024*1024;
+ while ($read == $size)
+ {
+ $read = sysread (FI,$data,$size);
+ print $data;
+ }
+ close (FI);
+ $file1++;
+ }
+
+ $fi = sprintf ("%03d.vdr",$file2);
+ open (FI,$fi);
+ while ($cond == 0)
+ {
+ if ($count > $size)
+ {
+ $read = sysread (FI,$data,$size);
+ print $data;
+ $count -= $size;
+ }
+ else
+ {
+ $read = sysread (FI,$data,$count);
+ print $data;
+ $cond = 1;
+ }
+ }
+ }
diff --git a/Tools/schnitt/schnitt3.pl b/Tools/schnitt/schnitt3.pl
new file mode 100755
index 0000000..7cc0f7f
--- /dev/null
+++ b/Tools/schnitt/schnitt3.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl
+
+require "/usr/local/bin/my/schnittcommon.pli";
+
+open (INDEX,"index.vdr");
+$index = $ARGV[0];
+&nextI;
+
+$oldindex = $index;
+$tempindex = $index;
+
+$add = -1;
+
+$fi = sprintf ("%03d.vdr",$file);
+open (FI2,$fi);
+open (FO,">test");
+sysseek (FI2,$offset,0);
+sysread (FI2,$temp,3000000);
+syswrite (FO,$temp,3000000);
+close (FI2);
+close (FO);
+`/usr/local/bin/pvademux.old . test`;
+if ( -s "test.mp2")
+ {
+ `rm test*`;
+ print "$index\n";
+ exit 0;
+ }
+
+while (1)
+ {
+ if ($index == 0)
+ {
+ $add = 1;
+ }
+ if ($add = -1)
+ {
+ $index--;
+ &prevI;
+ }
+ else
+ {
+ nextI;
+ }
+ $fi = sprintf ("%03d.vdr",$file);
+ open (FI2,$fi);
+ open (FO,">test");
+ sysseek (FI2,$offset,0);
+ sysread (FI2,$temp,3000000);
+ syswrite (FO,$temp,3000000);
+ close (FI2);
+ close (FO);
+ `/usr/local/bin/pvademux.old . test`;
+ if ( -s "test.mp2")
+ {
+ `rm test*`;
+ if ($index < 0)
+ {
+ $index *= -1;
+ }
+ print "$index\n";
+ exit 0;
+ }
+ }
diff --git a/Tools/schnitt/schnitt3.pl.new b/Tools/schnitt/schnitt3.pl.new
new file mode 100755
index 0000000..04a6239
--- /dev/null
+++ b/Tools/schnitt/schnitt3.pl.new
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+
+require "/usr/local/bin/my/schnittcommon.pli";
+
+open (INDEX,"index.vdr");
+
+$index = $ARGV[0];
+&nextI;
+
+$oldindex = $index;
+$tempindex = $index;
+
+$add = -1;
+
+$fi = sprintf ("%03d.vdr",$file);
+open (FI2,$fi);
+open (FO,">test2");
+sysseek (FI2,$offset,0);
+sysread (FI2,$temp,3000000);
+syswrite (FO,$temp,3000000);
+close (FI2);
+close (FO);
+
+system ("pes2av_pes test2 > test 2>/dev/null");
+open (PVA,"/usr/local/bin/pvademux.old . test 2>&1 |");
+
+@a=<PVA>; close PVA;
+@b=split (/\s/,$a[2]);
+
+if (!($b[4] =~ /\-/) && $b[4] < 2000)
+ {
+ unlink <test*>;
+ print "$index\n";
+ exit 0;
+ }
+
+while (1)
+ {
+ if ($index == 0)
+ {
+ $add = 1;
+ }
+ if ($add = -1)
+ {
+ $index--;
+ &prevI;
+ }
+ else
+ {
+ nextI;
+ }
+ $fi = sprintf ("%03d.vdr",$file);
+ open (FI2,$fi);
+ open (FO,">test2");
+ sysseek (FI2,$offset,0);
+ sysread (FI2,$temp,3000000);
+ syswrite (FO,$temp,3000000);
+ close (FI2);
+ close (FO);
+
+system ("/usr/local/bin/pes2av_pes test2 > test 2>/dev/null");
+open (PVA,"/usr/local/bin/pvademux.old . test 2>&1 |");
+
+@a=<PVA>; close PVA;
+@b=split (/\s/,$a[2]);
+
+if (!($b[4] =~ /\-/) && $b[4] < 2000)
+ {
+ unlink <test*>;
+ if ($index < 0)
+ {
+ $index *= -1;
+ }
+ print "$index\n";
+ exit 0;
+ }
+}
diff --git a/Tools/schnitt/schnitt4.pl b/Tools/schnitt/schnitt4.pl
new file mode 100755
index 0000000..75f2ad1
--- /dev/null
+++ b/Tools/schnitt/schnitt4.pl
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+open (FI,$ARGV[0]) or die "Kann Input-Datei nicht oeffnen";
+$count = 1;
+
+while (<FI>)
+ {
+ chomp;
+ $char = sprintf ("%c",$count + 96);
+ print "Cutting from/to $_ into /x2/clips/$char\n";
+ system ("/usr/local/bin/my/schnitt2.pl $_ > /x2/clips/$char");
+ $count++;
+ }
diff --git a/Tools/schnitt/schnitt5.pl b/Tools/schnitt/schnitt5.pl
new file mode 100755
index 0000000..7626ab5
--- /dev/null
+++ b/Tools/schnitt/schnitt5.pl
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+require "/usr/local/bin/my/schnittcommon.pli";
+
+open (INDEX,"index.vdr");
+$index = $ARGV[0] - 15000;
+&nextI;
+
+$file1 = $file;
+
+$index += 30000;
+&nextI;
+
+$file2 = $file;
+
+print "$file1 $file2\n";
+
diff --git a/Tools/schnitt/schnitt6.pl b/Tools/schnitt/schnitt6.pl
new file mode 100755
index 0000000..92d9eb4
--- /dev/null
+++ b/Tools/schnitt/schnitt6.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+open (FI,"a");
+
+while (<FI>)
+{
+ open (SCH,"/usr/local/bin/my/schnitt5.pl $_|");
+ $files = <SCH>;
+ chomp $files;
+ ($a,$b) = split (/\s/,$files);
+ $files[$a] = 1;
+ $files[$b] = 1;
+ close (SCH);
+}
+
+while (<0*.vdr>)
+{
+ $_ =~ /\d(\d\d)\.vdr/;
+ if ($files[$1])
+ {
+ print "Keeping $1\n";
+ }
+ else
+ {
+ print "Deleting $_\n";
+ unlink $_;
+ }
+}
+
+close (FI);
diff --git a/Tools/schnitt/schnittcommon.pli b/Tools/schnitt/schnittcommon.pli
new file mode 100755
index 0000000..f221f41
--- /dev/null
+++ b/Tools/schnitt/schnittcommon.pli
@@ -0,0 +1,64 @@
+sub nextI
+ {
+ if (!$size)
+ {
+ $size = -s INDEX;
+ }
+ local ($a,$b,$c,$dummy);
+ $cond = 0;
+ seek (INDEX,$index * 8,0);
+
+ while ($cond == 0)
+ {
+ &readnext;
+ if ($frame == 1)
+ {
+ $cond = 1;
+ }
+ else
+ {
+ $index++;
+ if ($index > ($size/8-1))
+ {
+ $index = $size/8-1;
+ &prevI;
+ print "$index\n";
+ exit 1;
+ }
+ }
+ }
+ }
+
+sub readnext
+ {
+ read (INDEX,$a,4);
+ read (INDEX,$b,1);
+ read (INDEX,$c,1);
+ read (INDEX,$dummy,2);
+ $offset = unpack ("L",$a);
+ $frame = unpack ("C",$b);
+ $file = unpack ("C",$c);
+ }
+
+sub prevI
+ {
+ local ($a,$b,$c,$dummy);
+ $cond = 0;
+ seek (INDEX,$index * 8,0);
+
+ while ($cond == 0)
+ {
+ &readnext;
+ if ($frame == 1)
+ {
+ $cond = 1;
+ }
+ else
+ {
+ $index--;
+ seek (INDEX,$index * 8,0);
+ }
+ }
+ }
+
+1;
diff --git a/Tools/schnitt/show b/Tools/schnitt/show
new file mode 100755
index 0000000..afed79b
--- /dev/null
+++ b/Tools/schnitt/show
@@ -0,0 +1,11 @@
+#!/bin/sh
+cd /x2/temp
+while true
+do
+ if [ -f newpic ]; then
+ killall xli
+ rm -f newpic
+ xli output.ppm &
+ fi
+sleep 24h
+done
diff --git a/Tools/schnitt/unsort b/Tools/schnitt/unsort
new file mode 100755
index 0000000..83adfb6
--- /dev/null
+++ b/Tools/schnitt/unsort
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+while (<>)
+{
+ $h{$_}=1;
+}
+
+foreach $key (sort shuffle keys %h)
+{
+ print $key;
+}
+
+sub shuffle {
+ $ran = rand(1);
+
+ if ($ran > 0.5)
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
diff --git a/Tools/schnitt/vdr-remote.pl b/Tools/schnitt/vdr-remote.pl
new file mode 100755
index 0000000..32d408e
--- /dev/null
+++ b/Tools/schnitt/vdr-remote.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Socket;
+
+my ($dest, $port, $iaddr, $paddr, $proto, $line);
+
+$dest = "localhost";
+$port = "2001";
+
+$iaddr = inet_aton($dest) || Error("no host: $dest");
+$paddr = sockaddr_in($port, $iaddr);
+
+$proto = getprotobyname('tcp');
+socket(SOCK, PF_INET, SOCK_STREAM, $proto) || Error("socket: $!");
+connect(SOCK, $paddr) || Error("connect: $!");
+select (SOCK); $| = 1;
+$a=<SOCK>;
+
+for (;;)
+ {
+ open (FI,"/tmp/vdr-keys");
+ while (<FI>)
+ {
+ chomp;
+ print "$_\r\n";
+ $a=<SOCK>;
+ }
+ close (FI);
+ }
+
+print "quit\r\n";
+$a=<SOCK>;
+close (SOCK) || Error("close: $!");
+
+sub Error
+{
+ print STDERR "@_\n";
+ exit 0;
+}
diff --git a/Tools/schnitt/vdr2 b/Tools/schnitt/vdr2
new file mode 100755
index 0000000..96557bf
--- /dev/null
+++ b/Tools/schnitt/vdr2
@@ -0,0 +1,2 @@
+#!/bin/sh
+irpty ~/.lircrc-vdr -- vdr -c /home/ms/.vdr -v /video/video0
diff --git a/Tools/schnitt/vmount b/Tools/schnitt/vmount
new file mode 100755
index 0000000..6b79064
--- /dev/null
+++ b/Tools/schnitt/vmount
@@ -0,0 +1,18 @@
+#!/bin/sh
+count=1
+cond=0
+
+if [ -f "$1" ]; then
+ mount "$1" /mnt/1 -o loop
+ $cond = 1
+else
+ while [ "$cond" != "1" ]
+ do
+ if [ -f "$1$count" ]; then
+ mount "$1$count" /mnt/$count -o loop
+ else
+ cond=1
+ fi
+ let count=count+1
+ done
+fi