Determination of quark-antiquark potentials and meson spectra