refactor split time parsing

This commit is contained in:
Christian Schabesberger 2018-09-09 14:01:39 +02:00
parent 49b72cbe5d
commit 8a4afe2548
1 changed files with 6 additions and 10 deletions

View File

@ -31,20 +31,16 @@ public class YoutubeParsingHelper {
public static long parseDurationString(String input)
throws ParsingException, NumberFormatException {
String[] splitInput;
// If time separator : is not detected, try . instead
if (input.contains(":")) {
splitInput = input.split(":");
} else {
splitInput = input.split("\\.");
}
final String[] splitInput = input.contains(":")
? input.split(":")
: input.split("\\.");
String days = "0";
String hours = "0";
String minutes = "0";
String seconds;
final String seconds;
switch (splitInput.length) {
case 4: