bugfixing
This commit is contained in:
parent
807a723506
commit
c5bf89fb4d
|
@ -1,3 +1,4 @@
|
||||||
/.idea/
|
/.idea/
|
||||||
/target/
|
/target/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
/MangranaCommons.iml
|
||||||
|
|
|
@ -3,6 +3,7 @@ package tv.mangrana.utils;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class Output {
|
public class Output {
|
||||||
|
@ -14,7 +15,11 @@ public class Output {
|
||||||
System.out.println(msg);
|
System.out.println(msg);
|
||||||
}
|
}
|
||||||
public static void log (String msg, Object... params) {
|
public static void log (String msg, Object... params) {
|
||||||
|
try {
|
||||||
log(msg(msg, params));
|
log(msg(msg, params));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log("error trying to log with msg="+msg+" and params "+Arrays.toString(params));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logWithDate(String msg) {
|
public static void logWithDate(String msg) {
|
||||||
|
|
|
@ -15,11 +15,15 @@ public class StringCaptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSeasonFolderNameFromSeason(String seasonFolderName) throws IncorrectWorkingReferencesException {
|
public static String getSeasonFolderNameFromSeason(String seasonFolderName) throws IncorrectWorkingReferencesException {
|
||||||
String season = Optional.ofNullable(
|
Optional<String> typicalFormat = Optional.ofNullable(StringCaptor.getMatchingSubstring(seasonFolderName, "(S\\d{2})"));
|
||||||
StringCaptor.getMatchingSubstring(seasonFolderName, "(S\\d{2})"))
|
if (typicalFormat.isPresent()) {
|
||||||
.orElseThrow(() ->
|
return typicalFormat.get().replaceFirst("S", "Temporada ");
|
||||||
new IncorrectWorkingReferencesException("Couldn't determinate the season from: "+seasonFolderName));
|
}
|
||||||
return season.replaceFirst("S", "Temporada ");
|
Optional<String> weirdFormat = Optional.ofNullable(StringCaptor.getMatchingSubstring(seasonFolderName, "(T\\d{1,2})"));
|
||||||
|
if (weirdFormat.isPresent()) {
|
||||||
|
return weirdFormat.get().replaceFirst("T", "Temporada ");
|
||||||
|
}
|
||||||
|
throw new IncorrectWorkingReferencesException("Couldn't determinate the season from: "+seasonFolderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSeasonFolderNameFromEpisode(String episodeFileName) throws IncorrectWorkingReferencesException {
|
public static String getSeasonFolderNameFromEpisode(String episodeFileName) throws IncorrectWorkingReferencesException {
|
||||||
|
|
Loading…
Reference in New Issue