summaryrefslogtreecommitdiff
path: root/Tools/schnitt/cut3.pl
blob: ddaf0d6f14e280673a890c42c907da5855f92a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl

$read = $size = 1024*1024;

$dir = $ARGV[0];
$subdir = $ARGV[1];
$teil = $ARGV[2];
$count1 = $ARGV[3];
$title = $ARGV[4];

$filenum = "1";
$count = 0;

open (FI,">$dir/$subdir/$teil.$filenum.mpg");

while ($read == $size)
  {
    if (($filenum == 1 && $count < $count1) || ($filenum > 1 && $count < 660*1024*1024))
      {
	$read = read (STDIN,$data,$size);
	print FI $data;
	$count += $size;
	$a = $count /1024/1024;
      }
    else
      {
	close (FI);
	$filenum++;
	$subdir++;
        mkdir ("$dir/$subdir");
	open (FF,">$dir/$subdir/$title\ CD\ $subdir");
	close (FF);
	open (FI,">$dir/$subdir/$teil.$filenum.mpg");
	$count = 0;
      }
  }

close FI;

print "$subdir\n";