Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Burn a CD-R without using a temporary image' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Burn a CD-R without using a temporary image
Authored by: omnivector on Dec 17, '03 03:50:35AM
here's my "advanced" burndir script which lets you specify a directory AND a volume name for the cd. (i like having my cds pop up with pretty names on the desktop). it also detects if you're using a superdrive or regular cd burner and picks the appropriate device for you. it also does error checking if you leave out a cdname, it defaults to the directory specified, but chopped. so you can even do stuff like burndir . and if . is, /Users/username/Documents it will name the cd Documents, instead of "." i tried to cover every possibility. here it is, written in ruby (ruby comes with os x)

#!/usr/bin/env ruby

# usage error
if ARGV.length < 1 or ARGV.length > 2 then
    $stderr.puts( "Usage: burndir directory [cd name]" )
    exit( 1 )
end

# detect superdrive or cd burner
drive = `system_profiler SPIDEDataType | grep DVD-RW`.chomp
burnerType = if drive.length == 0 then
        "IOCompactDiscServices"
    else
        "IODVDServices"
    end

# get variables
dir = ARGV.shift
cdname = if ARGV.length == 0 then
        File.basename( File.expand_path( dir ) )
    else
        ARGV.shift
    end

# burn the sucker
puts( `mkisofs -V "#{cdname}" -J -r "#{dir}" | cdrecord dev=#{burnerType} -v -` )
enjoy!

---
- Tristan

[ Reply to This | # ]

Combo Drives Are IODVDServices
Authored by: Enkerli on Dec 18, '03 10:49:34AM

Nice script except that Combo drives (as the one in my iBook) are "IODVDServices" and the test doesn't seem to catch this. There's probably a way to test DVD-ROM instead of -RW but I just skipped the test and put dev=IODVDServices directly as a cdrecord argument...



[ Reply to This | # ]
Combo Drives Are IODVDServices
Authored by: omnivector on Dec 19, '03 01:48:14AM
could you give me the output of

system_profiler SPIDEDataType
so i can fix it?

---
- Tristan

[ Reply to This | # ]

Burn a CD-R without using a temporary image
Authored by: clith on Dec 18, '03 01:00:46PM
And here is the perlocratic response:
#!/usr/bin/perl

if(@ARGV < 1 || @ARGV > 2) {
	warn "Usage: burndir directory [cd name]\n";
	exit 1;
}

# detect superdrive or cd burner
chomp($drive = `system_profiler SPIDEDataType | grep DVD-RW`);
$burnerType = ((length $drive == 0) ? "IOCompactDiscServices" : "IODVDServices");

# get variables
$dir = shift;
$cdname = shift;
$cdname = $dir unless $cdname;
$cdname =~ s#.*/##;

# burn the sucker
system "mkisofs -V \"${cdname}\" -J -r \"${dir}\" | cdrecord dev=${burnerType} -v -", "\n";
Note, also, that you can get cdrecord using OpenDarwin's "port" command:
    port install cdrtools

Enjoy

[ Reply to This | # ]

Burn a CD-R without using a temporary image
Authored by: omnivector on Dec 19, '03 01:46:10AM

your script doesn't handle the burndir . option correctly (hence why i use File.expand_path)

plus it's written in nasty, nasty perl :)

---
- Tristan



[ Reply to This | # ]
Burn a CD-R without using a temporary image
Authored by: bluehz on Dec 21, '03 12:06:53AM

Sure seems to take a long time to pull from that System Profile bit. Could you get the necessary info from here...

cdrecord dev=IODVDServices -atip

or

cdrecord dev=IOCompactDiscServices -atip



[ Reply to This | # ]
Burn a CD-R without using a temporary image
Authored by: omnivector on Dec 21, '03 03:16:05AM

i agree that it takes awhile. however it's a small price to pay for burning a cd which usually takes a few minutes.

your method may work, but it didn't when i tried as a user. it might work with sudo but then the user would have to type their password in.

---
- Tristan



[ Reply to This | # ]
Improved script
Authored by: ThreeDayMonk on Feb 18, '04 05:47:51AM

Impoved to handle combo drives as well:

#!/usr/bin/env ruby

# usage error
if ARGV.length < 1 or ARGV.length > 2 then
    $stderr.puts( "Usage: burndir directory [cd name]" )
    exit( 1 )
end

# detect burner type
# super- and combo drives are "IODVDServices"
sysprof = `system_profiler SPIDEDataType`
burnerType = if sysprof =~ /DVD-RW|CD-RW\/DVD-ROM/ then
        "IODVDServices"
    else
        "IOCompactDiscServices"
    end

# get variables
dir = ARGV.shift
cdname = if ARGV.length == 0 then
        File.basename( File.expand_path( dir ) )
    else
        ARGV.shift
    end

# burn the sucker
puts( `mkisofs -V "#{cdname}" -J -r "#{dir}" | cdrecord dev=#{burnerType} -v -` )



[ Reply to This | # ]