how do you change the name of a CD to be burned with drutil

Thanks for replying.

The drutil command only accepts a path to a folder containing the audio files you wish to burn to an Audio CD. It then burns each file with track 01, track 02, etc. The name of the CD then becomes “Audio CD”. I have tried it with a filename anyway, but it errors out.

any other thoughts?

Model: macbook
AppleScript: 2.1.1
Browser: Safari 531.9
Operating System: Mac OS X (10.6)

I guess, the Red Book specification doesn’t allow any custom naming.

:frowning: It doesn’t make sense though!!!

Also the following link to the Apple OS X Disk recording Framework suggests that you can change names

http://developer.apple.com/mac/library/documentation/MusicAudio/Reference/DiscRecordingFrameworkRef/index.html#//apple_ref/doc/uid/TP40004404:

hey Beeman

thier’s a script at this link that you may be able to use parts to do what you want

http://www.macosxhints.com/article.php?story=20050105061854200

interesting, but

that script uses the command “hdiutil” which is for hybrid CD/DVD’s not audio CD’s

I am sure there must be a way around this

“I am sure there must be a way around this”

Their is, it’s in the script I linked you to, theirs parts in the script that label the disk, I tried it and it worked, just adapt script portions to suit your needs.

It maybe in the way the text is returned to the do shell script portion, i’m not up to scratch with shell script, maybe some one else here can sort it for you, good luck.

something like this maybe (untested)

display dialog "Example: Burned Files" with title "Name the  CD" default answer ""
if the text returned of the result is not "" then
	set cdName to the text returned of the result
end if
set burn_folder to "Macintosh HD:Users:Budgie:Desktop:test:"
set Burn_the_disk to do shell script "drutil -drive internal burn -audio " & "-default-volume-name " & quoted form of cdName & quoted form of burn_folder
--set Burn_the_disk to do shell script "drutil -drive internal burn -audio " & quoted form of burn_folder & " " & quoted form of cdName

thanks for replying and working this problem with me.

I will look at the link again to make sure I understand

in your sample script you changed the order in the actual script step to burn a CD and the comment you wrote after about the script step. Does that matter?

set Burn_the_disk to do shell script "drutil -drive internal burn -audio " & "-default-volume-name " & quoted form of cdName & quoted form of burn_folder
–set Burn_the_disk to do shell script "drutil -drive internal burn -audio " & quoted form of burn_folder & " " & quoted form of cdName

again thanks

im not sure about the order, as ive said im not up to scratch with shell scripting, their are others here who may be able to help with that. sorry should have removed the commented code.

did the code do anything useful?

I will not be able to try this out until later this week

thanks again

from http://en.wikipedia.org/wiki/CDDB

The need for CDDB is a direct consequence of the original design of the CD, which was conceived as an evolution of the gramophone record, and did not consider the audio tracks as data files to be identified and indexed. The audio CD format does not include the disc name or track names, so a supplemental database is needed to supply this information when discs are used with modern media systems. A later development called CD-Text is another solution to the same problem.

@Budgie
where does this default-volume-name switch come from? It’s not documented in none of the drutil man pages

Ok so I tried

set Burn_the_disk to do shell script "drutil -drive internal burn -audio " & "-default-volume-name " & quoted form of cdName & “” & quoted form of burn_folder

and got this error

error "Usage: drutil -drive [drive-arguments] command [command-options-and-arguments]
drutil commands are:
atip Displays ATIP information about inserted CD-R/RW media.
bulkerase Bulk erases -RW media in either quick or full mode.
drutil bulkerase (quick | full)
burn Burns a given file or directory to disc.
drutil burn (burn-options)
cdtext Displays CD-Text present on an audio CD.
discinfo Displays disc related info when media is present.
dumpiso Parses ISO-9660 directory structures.
drutil dumpiso [format]
dumpudf Parses UDF directory structures.
drutil dumpudf [format]
eject Ejects media from the drive (if any).
erase Erases -RW media in either quick or full mode.
drutil erase (quick | full)
filename Translates filenames for different filesystems.
drutil filename
getconfig Displays current and supported device features and profiles.
drutil getconfig (current | supported)
info Displays detailed information about connected drives.
list Lists all connected burning devices.
poll Constantly polls and displays device notifications.
size Estimates size of a given file or directory.
status Displays detailed information about inserted media.
subchannel Displays subchannel (MCN, ISRC) info when CD media is present.
toc Displays TOC information about inserted CD media.
trackinfo Displays track related info when media is present.
tray Opens and closes drive tray, and ejects media.
drutil tray (open | close | eject)
version Display the OS and DiscRecording version numbers.
(specify drutil help for command specific help)
(specify drutil help driveselect for drive selection help)
" number 1

so I don’t think the switch -default-volume-name " & quoted form of cdName works for drutil

any thoughts?

Stefan: this is the script from the link I supplied to Beeman, it has the term default-volume-name in it, where it originated I have no idea.:confused:

else if chosenAction is "Burn CD" then
		do shell script "hdiutil makehybrid " & formatsToUse & ¬
			"-default-volume-name " & quoted form of cdName & " -o " & imageCDpath & " " & sourceFolder
		display dialog "Your CD is being burned. The computer will eject it when it has finished burning." buttons {"OK"} default button 1
		do shell script "hdiutil burn " & imageCDpath & " -forceclose -eject"
	end if
tell application "System Events"
	activate
	
	(* get the formats the user wishes to use
	
	 There is seemingly a bug in this - no matter what I try, I can't get this 
	 dialog box to recognize pressing Cancel. It just goes on to the next dialog. 
	 I also can't figure a way around the bug...
	 
	The only thing I've been able to figure out to do is set the
	cancel button as an "All formats" button and then set the chosen
	formats manually. But this means that for now there is no cancel button  : (   *)
	set chosenFormats to {}
	choose from list {"HFS+", "UDF", "ISO 9660"} with prompt ¬
		"Which CD format(s) do you wish to use?" with title "Burn Hybrid CD" OK button name "Continue" cancel button name ¬
		"All Formats" with multiple selections allowed without empty selection allowed
	if the result is not false then
		set chosenFormats to the result
	else
		set chosenFormats to {"HFS+", "UDF", "ISO 9660"}
	end if
	
	-- ask the user if the Joliet extensions to ISO 9660 are desired. Add them if they are desired.
	repeat with i from 1 to count of chosenFormats
		if item i of chosenFormats is equal to "ISO 9660" then
			display dialog "Would you like to add Joliet extensions to the ISO filesystem?" buttons {"Do not add Joliet", "Add Joliet"} default button 2
			if the button returned of the result is "Add Joliet" then
				set chosenFormats to chosenFormats & {"Joliet"}
				exit repeat
			end if
		else
			set i to i + 1
		end if
	end repeat
	
	(* set the variable that will determine which formats are used later on
	in the shell script. It's rather kludgy: it could use some optimizing. *)
	set formatsToUse to ""
	set confirmationListOfFormats to ""
	(* in this, confirmationListOfFormats set to a semi-nice-looking
	string which will be used later to confirm that this is what the user wants *)
	if the (count of chosenFormats) is 4 then
		-- leave formatsToUse as empty
		set confirmationListOfFormats to "HFS+, UDF, ISO 9660, Joliet"
	else
		repeat with i from 1 to count of chosenFormats
			if item i of chosenFormats as string is equal to "HFS+" then
				set formatsToUse to formatsToUse & "-hfs "
				set confirmationListOfFormats to confirmationListOfFormats & "HFS+   "
			else if item i of chosenFormats as string is equal to "ISO 9660" then
				set formatsToUse to formatsToUse & "-iso "
				set confirmationListOfFormats to confirmationListOfFormats & "ISO 9660   "
			else if item i of chosenFormats as string is equal to "Joliet" then
				set formatsToUse to formatsToUse & "-joliet "
				set confirmationListOfFormats to confirmationListOfFormats & "Joliet   "
			else if item i of chosenFormats as string is equal to "UDF" then
				set formatsToUse to formatsToUse & "-udf "
				set confirmationListOfFormats to confirmationListOfFormats & "UDF   "
			end if
			set i to i + 1
		end repeat
	end if
	
	-- get the folder with the items to be burned
	choose folder with prompt "Select the folder containing the files you wish to include"
	set sourceFolder to the POSIX path of the result
	
	-- just a perk for the user: allowing the user to specify a name for the CD
	display dialog "Example: Burned Files" with title "Specify the name you want for the CD" default answer ""
	if the text returned of the result is not "" then
		set cdName to the text returned of the result
	else
		set cdName to "BurnedFiles"
	end if
	
	-- allow the user to choose what to do
	-- giving one last opt-out chance, and the ability to create just the image
	display dialog "Chosen folder:" & return & return & sourceFolder & return & return & ¬
		"Chosen filesystems:" & return & return & confirmationListOfFormats with title ¬
		"What would you like to do?" buttons {"Cancel", "Create Disk Image", "Burn CD"} default button 3
	set chosenAction to the button returned of the result
	
	-- prepare the variable for use below
	set sourceFolder to the quoted form of sourceFolder
	
	-- create a name for the disk image
	do shell script "uuidgen"
	set imageName to the result
	set imageCDpath to "~/Desktop/cdr" & imageName & ".iso"
	
	-- do what the user wants
	if chosenAction is "Create Disk Image" then
		do shell script "hdiutil makehybrid " & formatsToUse & ¬
			"-default-volume-name " & quoted form of cdName & " -o " & imageCDpath & " " & sourceFolder
		display dialog "Your Disk Image is being created. It will appear on the desktop when the process has finished." buttons {"OK"} default button 1
	else if chosenAction is "Burn CD" then
		do shell script "hdiutil makehybrid " & formatsToUse & ¬
			"-default-volume-name " & quoted form of cdName & " -o " & imageCDpath & " " & sourceFolder
		display dialog "Your CD is being burned. The computer will eject it when it has finished burning." buttons {"OK"} default button 1
		do shell script "hdiutil burn " & imageCDpath & " -forceclose -eject"
	end if
	
end tell

Gotcha.

Sorry, we are talking about burning an Audio CD with drutil, hdiutil burns images and creates Hybrid data CDs

yeah Beeman pointed that out to me earlier, regardless of that though, the issue stil remains, naming the disk?
the script above does name the disk, but how?, ive tested it and it does indeed put the user input into the title of the disk…

you have:

 -- just a perk for the user: allowing the user to specify a name for the CD
   display dialog "Example: Burned Files" with title "Specify the name you want for the CD" default answer ""
   if the text returned of the result is not "" then
       set cdName to the text returned of the result
   else
       set cdName to "BurnedFiles"
   end if

and

 else if chosenAction is "Burn CD" then
       do shell script "hdiutil makehybrid " & formatsToUse & ¬
           "-default-volume-name " & quoted form of cdName & " -o " & imageCDpath & " " & sourceFolder
       display dialog "Your CD is being burned. The computer will eject it when it has finished burning." buttons {"OK"} default button 1
       do shell script "hdiutil burn " & imageCDpath & " -forceclose -eject"
   end if

some where in here is the answer to naming the disk.

Right, but an Audio CD is not a data CD, hdutil can not burn audio CD’s

The difference is:

a data CD can be named while burning
an audio CD can’t

so how does an app like “Burn” that burn’s audio cd’s apply any given name to the Audio CD, theirs obviously code, but what code? and can this code be used along side apple script?

Burn probably uses CD-Text

But drutil doesn’t allow you to write cd-text, only to read it if it is present??

Sorry, I have no idea.
iTunes can burn Audio CD including CD-Text