diff options
author | Anderson Mesquita <andersonvom@gmail.com> | 2019-05-04 13:10:23 -0400 |
---|---|---|
committer | Anderson Mesquita <andersonvom@gmail.com> | 2019-05-05 00:04:06 -0400 |
commit | fb3bfa9f8018bd89b97fd0e0c53ea4fab1687aa2 (patch) | |
tree | fcd876a65ad60ae1fd7b2c719aea8830a124286b /core/src/test/java | |
parent | 9b41139709656d0e0a650acd0a17a67eac987ab7 (diff) | |
download | AntennaPod-fb3bfa9f8018bd89b97fd0e0c53ea4fab1687aa2.zip |
Handle iTunes single-number duration format
Apple says this [1] about the `<itunes:duration>` tag:
If you specify a single number as a value (without colons), Apple
Podcasts displays the value as seconds.
This commit makes it also handle this single-number format.
Closes: #3024
[1]: https://help.apple.com/itc/podcasts_connect/#/itcb54353390
Diffstat (limited to 'core/src/test/java')
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/syndication/parsers/DurationParserTest.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/test/java/de/danoeh/antennapod/core/syndication/parsers/DurationParserTest.java b/core/src/test/java/de/danoeh/antennapod/core/syndication/parsers/DurationParserTest.java index b73916b24..e7c861969 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/syndication/parsers/DurationParserTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/syndication/parsers/DurationParserTest.java @@ -17,6 +17,13 @@ public class DurationParserTest { } @Test + public void testSingleNumberDurationInMillis() { + int twoHoursInSeconds = 2 * 60 * 60; + long duration = DurationParser.inMillis(String.valueOf(twoHoursInSeconds)); + assertEquals(2 * hours, duration); + } + + @Test public void testMinuteSecondDurationInMillis() { long duration = DurationParser.inMillis("05:10"); assertEquals(5 * minutes + 10 * seconds, duration); |