Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 22. júl 2024

Súbor: [Platon] / scripts / perl / cdr-tool / cdr-tool (stiahnutie)

Revízia 1.1, Sun Mar 23 12:23:02 2003 UTC (21 years, 4 months ago) by yenar

added tool for commandline cd writing with multisession support [cdr-tool]

#!/usr/bin/perl
use strict;

my $mkiso_args = "-l -graft-points -v -J -r";
my $cdrecord_args = "-vv";
my $cdr_mnt = "/cdburner/";

# get cdr device name
sub dev {
    my $cdrsetup="/etc/cdrecord/cdrecord";
    my $dev_=`grep ^CDR_DEVICE $cdrsetup`;
    $dev_ =~ s/^.*?=(.*?)\n/$1/;
    my $dev=`grep ^$dev_ $cdrsetup`;
    $dev =~ s/^.*?=[ \t]*([\/A-Za-z0-9]+).*/$1/;
    $dev =~ s/\n//g;
    return $dev;
}

# get last session data
sub session {
    my $sess=`cdrecord -msinfo`;
    $sess =~ s/[ \t\n]+//g;
    return $sess;
}

# build burning command
sub iso_sz {
    my $args = join " ", @_;
    my $sz = `mkisofs -print-size -quiet $mkiso_args $args`;
    $sz =~ s/\n//g;
    print "'$sz'\n";
    return $sz;
}

sub addsz {
    $cdrecord_args .= " tsize=" . &iso_sz ("@ARGV")."s";
}

sub append {
    my $sess = &session;
    my $args;
    $args = "-C $sess -M ". &dev if ($sess);
    $args .= " " . join " ", @_;
    &addsz;
    return "mkisofs $mkiso_args $args | cdrecord $cdrecord_args -multi -";
}

sub blank {
     return "cdrecord $cdrecord_args blank=minimal";
}

sub multi {
    my $args = join " ", @_;
    &addsz;
    return "mkisofs $mkiso_args $args | cdrecord $cdrecord_args -multi -";
}

sub burnimage {
    my $args = join " ", @_;
    return "cat $args | cdrecord $cdrecord_args -";
}

sub single {
    my $args = join " ", @_;
    &addsz;
    return "mkisofs $mkiso_args $args | cdrecord $cdrecord_args -";
}

sub audio {
    my $args = join " ", @_;
    return "cdrecord $cdrecord_args -pad -audio $args";
}

sub reload {
    return "eject $cdr_mnt && eject -t $cdr_mnt";
}

my $cmd = shift @ARGV;

print "command: &$cmd (\"@ARGV\");\n";
my $run = eval "&$cmd (\"@ARGV\");";

# burn it!
print "$run\n";
my $ret = system $run;

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok