Why reinvent the wheel?
https://en.wikipedia.org/wiki/EasyTag

EasyTag has access to the CDDB, so there is that