Handle more then 23 hours

This commit is contained in:
Nathan Mascitelli 2019-02-12 20:53:17 -05:00
parent 39b9df5064
commit c49e98b546
2 changed files with 11 additions and 1 deletions

View File

@ -50,6 +50,16 @@ public class TimelineTest extends InstrumentationTestCase {
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
public void testProcessShownotesAddTimecodeHHMMSSMoreThen24HoursNoChapters() throws Exception {
final String timeStr = "25:00:00";
final long time = 25 * 60 * 60 * 1000;
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
String res = t.processShownotes(true);
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
public void testProcessShownotesAddTimecodeHHMMNoChapters() throws Exception {
final String timeStr = "10:11";
final long time = 3600 * 1000 * 10 + 60 * 1000 * 11;

View File

@ -70,7 +70,7 @@ public class Timeline {
private static final Pattern TIMECODE_LINK_REGEX = Pattern.compile("antennapod://timecode/((\\d+))");
private static final String TIMECODE_LINK = "<a class=\"timecode\" href=\"antennapod://timecode/%d\">%s</a>";
private static final Pattern TIMECODE_REGEX = Pattern.compile("\\b(?:(?:([01]?\\d|2[0-3]):)?([0-5]?\\d):)?([0-5]?\\d)\\b");
private static final Pattern TIMECODE_REGEX = Pattern.compile("\\b(?:(?:(\\d*):)?([0-5]?\\d):)?([0-5]?\\d)\\b");
private static final Pattern LINE_BREAK_REGEX = Pattern.compile("<br */?>");