Skip to content

Commit

Permalink
Forgot a bit from fix for noophq#21
Browse files Browse the repository at this point in the history
  • Loading branch information
berndmoos committed May 11, 2024
1 parent 0bce317 commit 8c33805
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/fr/noop/subtitle/vtt/VttParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,14 @@ private List<SubtitleLine> parseCueText(String cueText) {

private SubtitleTimeCode parseTimeCode(String timeCodeString) throws SubtitleParsingException {
try {
int hour = Integer.parseInt(timeCodeString.substring(0, 2));
int minute = Integer.parseInt(timeCodeString.substring(3, 5));
int second = Integer.parseInt(timeCodeString.substring(6, 8));
int millisecond = Integer.parseInt(timeCodeString.substring(9, 12));
String adjustedTimeCodeString = timeCodeString;
if (timeCodeString.length()<10){
adjustedTimeCodeString = "00:" + timeCodeString;
}
int hour = Integer.parseInt(adjustedTimeCodeString.substring(0, 2));
int minute = Integer.parseInt(adjustedTimeCodeString.substring(3, 5));
int second = Integer.parseInt(adjustedTimeCodeString.substring(6, 8));
int millisecond = Integer.parseInt(adjustedTimeCodeString.substring(9, 12));
return new SubtitleTimeCode(hour, minute, second, millisecond);
} catch (NumberFormatException e) {
throw new SubtitleParsingException(String.format(
Expand Down

0 comments on commit 8c33805

Please sign in to comment.