Renamed StringUtil.formatDuration to formatDurationMSS

master
Evan Harris 5 years ago
parent 0c0561d104
commit 0660c4f3e6
No known key found for this signature in database
GPG Key ID: FF3BD4DA59FF9EDC
  1. 2
      airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueInfo.java
  2. 2
      airsonic-main/src/main/java/org/airsonic/player/controller/VideoPlayerController.java
  3. 2
      airsonic-main/src/main/java/org/airsonic/player/domain/Playlist.java
  4. 2
      airsonic-main/src/main/java/org/airsonic/player/util/StringUtil.java
  5. 23
      airsonic-main/src/test/java/org/airsonic/player/util/StringUtilTestCase.java

@ -61,7 +61,7 @@ public class PlayQueueInfo {
durationSeconds += entry.getDuration(); durationSeconds += entry.getDuration();
} }
} }
return StringUtil.formatDuration(durationSeconds); return StringUtil.formatDurationMSS(durationSeconds);
} }
public boolean isStopEnabled() { public boolean isStopEnabled() {

@ -89,7 +89,7 @@ public class VideoPlayerController {
public static Map<String, Integer> createSkipOffsets(int durationSeconds) { public static Map<String, Integer> createSkipOffsets(int durationSeconds) {
LinkedHashMap<String, Integer> result = new LinkedHashMap<String, Integer>(); LinkedHashMap<String, Integer> result = new LinkedHashMap<String, Integer>();
for (int i = 0; i < durationSeconds; i += 60) { for (int i = 0; i < durationSeconds; i += 60) {
result.put(StringUtil.formatDuration(i), i); result.put(StringUtil.formatDurationMSS(i), i);
} }
return result; return result;
} }

@ -113,7 +113,7 @@ public class Playlist {
} }
public String getDurationAsString() { public String getDurationAsString() {
return StringUtil.formatDuration(durationSeconds); return StringUtil.formatDurationMSS(durationSeconds);
} }
public Date getCreated() { public Date getCreated() {

@ -228,7 +228,7 @@ public final class StringUtil {
/** /**
* Formats a duration with minutes and seconds, e.g., "93:45" * Formats a duration with minutes and seconds, e.g., "93:45"
*/ */
public static String formatDuration(int seconds) { public static String formatDurationMSS(int seconds) {
int minutes = seconds / 60; int minutes = seconds / 60;
int secs = seconds % 60; int secs = seconds % 60;

@ -81,17 +81,18 @@ public class StringUtilTestCase extends TestCase {
assertEquals("Error in formatBytes().", "4413,43 TB", StringUtil.formatBytes(4852617603375432L, locale)); assertEquals("Error in formatBytes().", "4413,43 TB", StringUtil.formatBytes(4852617603375432L, locale));
} }
public void testFormatDuration() { public void testFormatDurationMSS() {
assertEquals("Error in formatDuration().", "0:00", StringUtil.formatDuration(0)); assertEquals("Error in formatDurationMSS().", "0:00", StringUtil.formatDurationMSS(0));
assertEquals("Error in formatDuration().", "0:05", StringUtil.formatDuration(5)); assertEquals("Error in formatDurationMSS().", "0:05", StringUtil.formatDurationMSS(5));
assertEquals("Error in formatDuration().", "0:10", StringUtil.formatDuration(10)); assertEquals("Error in formatDurationMSS().", "0:10", StringUtil.formatDurationMSS(10));
assertEquals("Error in formatDuration().", "0:59", StringUtil.formatDuration(59)); assertEquals("Error in formatDurationMSS().", "0:59", StringUtil.formatDurationMSS(59));
assertEquals("Error in formatDuration().", "1:00", StringUtil.formatDuration(60)); assertEquals("Error in formatDurationMSS().", "1:00", StringUtil.formatDurationMSS(60));
assertEquals("Error in formatDuration().", "1:01", StringUtil.formatDuration(61)); assertEquals("Error in formatDurationMSS().", "1:01", StringUtil.formatDurationMSS(61));
assertEquals("Error in formatDuration().", "1:10", StringUtil.formatDuration(70)); assertEquals("Error in formatDurationMSS().", "1:10", StringUtil.formatDurationMSS(70));
assertEquals("Error in formatDuration().", "10:00", StringUtil.formatDuration(600)); assertEquals("Error in formatDurationMSS().", "10:00", StringUtil.formatDurationMSS(600));
assertEquals("Error in formatDuration().", "45:50", StringUtil.formatDuration(2750)); assertEquals("Error in formatDurationMSS().", "45:50", StringUtil.formatDurationMSS(2750));
assertEquals("Error in formatDuration().", "83:45", StringUtil.formatDuration(5025)); assertEquals("Error in formatDurationMSS().", "83:45", StringUtil.formatDurationMSS(5025));
assertEquals("Error in formatDurationMSS().", "121:40", StringUtil.formatDurationMSS(7300));
} }
public void testSplit() { public void testSplit() {

Loading…
Cancel
Save