* more lenient number parsing
This commit is contained in:
parent
99bade0e66
commit
49561dd944
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue