* more lenient number parsing

This commit is contained in:
Reinhard Pointner 2016-01-10 02:58:49 +00:00
parent 99bade0e66
commit 49561dd944
1 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,8 @@ import java.io.IOException;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -84,8 +86,8 @@ public class ID3Lookup implements MusicIdentificationService {
String value = getString(mediaInfo, field); String value = getString(mediaInfo, field);
if (value != null) { if (value != null) {
try { try {
return new Integer(value); return new Scanner(value).useDelimiter("\\D+").nextInt();
} catch (Exception e) { } catch (NumberFormatException | NoSuchElementException e) {
Logger.getLogger(ID3Lookup.class.getName()).log(Level.WARNING, e.toString()); Logger.getLogger(ID3Lookup.class.getName()).log(Level.WARNING, e.toString());
} }
} }