Anharmonic infrared and Raman spectra in Car-Parrinello molecular dynamics simulations