The solution is an online database of millions of CDs with that information. Clever CD to MP3 conversion programs can generate an almost certainly unique “serial number” for each CD by looking at the length of each track. The odds of separate unrelated CDs having lengths which match is incredibly low. Of course your computer has to be connected to the Internet and your conversion program has to be compatible with the freedb database for this to work.
The key limitation of freedb is most of the data is submitted by users. When a new CD is submitted which isn’t in freedb’s database the user has the option to enter the information for that CD. Users can certainly make typos, enter names in the wrong format, or other inconsistencies. As a consequence when your program queries freedb you may be given several basically identical choices (e.g. “Beatles, the White Album”, “The White Album”, “White Album, The”, or even “White Album – Beetles”).
You cannot download or purchase MP3s from freedb, it’s a database of information about songs, not an online collection.
Freedb is a GNU licensed database and it’s been promised that the data will always be free, even though it’s controlled by a commercial company (Magix) which sells audio editing software.
Magix’s Audio Cleaning Lab is an excellent CD ripping program and is also an excellent audio editor and CD burner. But if you only need to convert audio CDs into MP3s in Windows there’s a free program, Audiograbber