This works for me, however the system must first recognize the disc that's inserted. Otherwise it can't return a value for a property of a disc it hasn't or can't recognize. I have noticed with RW optical media that it can take some time for the disc to be recognized. I have tested with CD-R, CD-RW, DVD+R and DVD+RW optical media and all report the Media Type correctly in Disk Utility and Optical Media Type correctly using diskutil.

You should be able to ascertain the Media Type by using the Info button in Disk Utility after selecting the target optical device.

You should be able to ascertain the Optical Media Type from the command line in Terminal using the following command:

diskutil info diskN

Where N in diskN is a integer value of the target optical device, e.g.: disk2

To isolate just the Optical Media Type info, use the following command:

diskutil info diskN | grep 'Optical Media Type'

On my system, using the proper number in diskN, the output for the disc I have currently inserted in the SuperDrive is:

  Optical Media Type:       CD-R

You could also use the following command in Terminal:

system_profiler SPDiscBurningDataType

The output of which on my system for the disc currently inserted is:

$ system_profiler SPDiscBurningDataType
Disc Burning:

    HL-DT-ST DVDRW  GX40N:

      Firmware Revision: RQ00
      Interconnect: USB
      Burn Support: Yes (Apple Shipping Drive)
      Cache: 1024 KB
      Reads DVD: Yes
      CD-Write: -R, -RW
      DVD-Write: -R, -R DL, -RW, +R, +R DL, +RW
      Write Strategies: CD-TAO, CD-SAO, CD-Raw, DVD-DAO
      Media:
          Type: CD-R
          Blank: Yes
          Erasable: No
          Overwritable: Yes
          Appendable: Yes
          Write Speeds: 10x, 16x, 24x

$ 

This info is also available in System Information via the GUI under: Hardware > Disc Burning


Note: The information contained herein was tested under OS X 10.8.6 and if using diskutil info on the target optical drive in a different version of OS X/macOS then you might want to not filter the output through grep until sure that diskutil info on the target optical drive has an Optical Media Type: property listed, on whatever version is being used, as it does in OS X 10.8.6.