Determining a CD-R(W)'s capacity

http://unix.stackexchange.com –
I've seen various questions asked (and answered) regarding how to detect the size of various media on a GNU/Linux system, and in particular how much space has been used on an optical drive. But is there anything I can do to detect the capacity of a CD-R(W) (i.e. is it a 650 / 700 / ... MB CD-RW)?
I suspect that cdrecord / wodim is able to detect that before it even attempts to burn an ISO, but so far I haven't been able to use it to obtain the information I want.
EDIT: I intend to use this information in a script I'm writing, so I'm only interested in command line tools (whose output I would
(HowTos)