Selective recovery of metals from waste batteries