diff options
author | Nathan Mascitelli <mascitelli.nathan@gmail.com> | 2019-02-10 18:01:00 -0500 |
---|---|---|
committer | Nathan Mascitelli <mascitelli.nathan@gmail.com> | 2019-02-10 18:01:00 -0500 |
commit | 96b0336b2cbaa2166964757c089957bf4f1a420b (patch) | |
tree | ad02878b2270a75b86267da95d900e9eee4cf1b8 /core/src/main/java | |
parent | 9180be85ba216e501b6ccfac9f9eba20d40d0021 (diff) | |
download | AntennaPod-96b0336b2cbaa2166964757c089957bf4f1a420b.zip |
Update Timeline regex
Regex now looks for the new types of short and long timestamps.
Diffstat (limited to 'core/src/main/java')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/Converter.java | 12 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java index 6966667bf..1f9418c98 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java @@ -76,11 +76,11 @@ public final class Converter { /** Converts milliseconds to a string containing hours and minutes */ public static String getDurationStringShort(int duration) { - int h = duration / HOURS_MIL; - int rest = duration - h * HOURS_MIL; - int m = rest / MINUTES_MIL; + int minutes = duration / MINUTES_MIL; + int rest = duration - minutes * MINUTES_MIL; + int seconds = rest / SECONDS_MIL; - return String.format(Locale.getDefault(), "%02d:%02d", h, m); + return String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds); } /** Converts long duration string (HH:MM:SS) to milliseconds. */ @@ -100,8 +100,8 @@ public final class Converter { if (parts.length != 2) { return 0; } - return Integer.parseInt(parts[0]) * 3600 * 1000 + - Integer.parseInt(parts[1]) * 1000 * 60; + return Integer.parseInt(parts[0]) * 60 * 1000 + + Integer.parseInt(parts[1]) * 1000; } /** Converts milliseconds to a localized string containing hours and minutes */ diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java index 34cfe6d05..22349b029 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java @@ -68,7 +68,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(?:(?:(([0-9][0-9])):))?(([0-9][0-9])):(([0-9][0-9]))\\b"); + 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 LINE_BREAK_REGEX = Pattern.compile("<br */?>"); |