|
|
@ -219,42 +219,27 @@ public class JaudiotaggerParser extends MetaDataParser { |
|
|
|
* track numbers on the form "4/12". |
|
|
|
* track numbers on the form "4/12". |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Integer parseTrackNumber(String trackNumber) { |
|
|
|
private Integer parseTrackNumber(String trackNumber) { |
|
|
|
if (trackNumber == null) { |
|
|
|
return parseIntegerPattern(trackNumber, TRACK_NUMBER_PATTERN); |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer result = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
result = Integer.valueOf(trackNumber); |
|
|
|
|
|
|
|
} catch (NumberFormatException x) { |
|
|
|
|
|
|
|
Matcher matcher = TRACK_NUMBER_PATTERN.matcher(trackNumber); |
|
|
|
|
|
|
|
if (matcher.matches()) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
result = Integer.valueOf(matcher.group(1)); |
|
|
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Integer.valueOf(0).equals(result)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Integer parseYear(String year) { |
|
|
|
private Integer parseYear(String year) { |
|
|
|
if (year == null) { |
|
|
|
return parseIntegerPattern(year, YEAR_NUMBER_PATTERN); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Integer parseIntegerPattern(String str, Pattern pattern) { |
|
|
|
|
|
|
|
if (str == null) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Integer result = null; |
|
|
|
Integer result = null; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
result = Integer.valueOf(year); |
|
|
|
result = Integer.valueOf(str); |
|
|
|
} catch (NumberFormatException x) { |
|
|
|
} catch (NumberFormatException x) { |
|
|
|
Matcher matcher = YEAR_NUMBER_PATTERN.matcher(year); |
|
|
|
if (pattern == null) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Matcher matcher = pattern.matcher(str); |
|
|
|
if (matcher.matches()) { |
|
|
|
if (matcher.matches()) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
result = Integer.valueOf(matcher.group(1)); |
|
|
|
result = Integer.valueOf(matcher.group(1)); |
|
|
@ -272,18 +257,7 @@ public class JaudiotaggerParser extends MetaDataParser { |
|
|
|
|
|
|
|
|
|
|
|
private Integer parseInteger(String s) { |
|
|
|
private Integer parseInteger(String s) { |
|
|
|
s = StringUtils.trimToNull(s); |
|
|
|
s = StringUtils.trimToNull(s); |
|
|
|
if (s == null) { |
|
|
|
return parseIntegerPattern(s, null); |
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
Integer result = Integer.valueOf(s); |
|
|
|
|
|
|
|
if (Integer.valueOf(0).equals(result)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} catch (NumberFormatException x) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|