diff --git a/README.md b/README.md
index 2945af2..e04c6bb 100644
--- a/README.md
+++ b/README.md
@@ -18,10 +18,10 @@ You need a more or less recent Java SE Runtime Environment to run the released p
For a quick start you can unzip the release version (without subdirectory, but directly all three files) in a folder where you've already got one or more csv's from pokernow.club.
-Execute from the directory with containing 'handhistory-converter-0.2.3-jar-with-dependencies.jar' and the two properties files:
+Execute from the directory with containing 'handhistory-converter-0.2.4-jar-with-dependencies.jar' and the two properties files:
```
-java -jar handhistory-converter-0.2.3-jar-with-dependencies.jar
+java -jar handhistory-converter-0.2.4-jar-with-dependencies.jar
```
The csv files from pokernow.club in the directory should then get converted.
diff --git a/pom.xml b/pom.xml
index 9c9ac92..66f7c23 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
ch.evolutionsoft.poker.pokernow
handhistory-converter
- 0.2.3
+ 0.2.4
UTF-8
diff --git a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java
index de064e9..f351f5c 100644
--- a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java
+++ b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowConstants.java
@@ -9,6 +9,7 @@ private PokernowConstants() {
public static final String OMAHA_GAME_TYPE = "Pot Limit Omaha Hi";
public static final String OMAHA_HI_LO_GAME_TYPE = "Pot Limit Omaha Hi/Lo";
public static final String TEXAS_GAME_TYPE = "No Limit Texas Hold'em";
+ public static final int GAME_TYPE_GROUP = 1;
public static final String STARTING_HAND = "-- starting hand #";
public static final String ENDING_HAND = "-- ending hand #";
diff --git a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java
index 795776b..377e739 100644
--- a/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java
+++ b/src/main/java/ch/evolutionsoft/poker/pokernow/PokernowSingleHandConverter.java
@@ -11,6 +11,8 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
@@ -65,9 +67,20 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
String singleHandHistoryLine = bufferedReader.readLine();
String handNumber = readHandNumber(singleHandHistoryLine);
-
- String gameType = singleHandHistoryLine.substring(
- singleHandHistoryLine.indexOf('(') + 1, singleHandHistoryLine.indexOf(')'));
+
+ Pattern gameTypeGameIdPattern = Pattern.compile(
+ "hand " + HAND_NUMBER_PREFIX_CHAR + "\\d+ \\(id: \\w+\\)\\s+\\(([^\\)]+)\\)"
+ );
+
+ Matcher m = gameTypeGameIdPattern.matcher(singleHandHistoryLine);
+ String gameType = "UndefinedGameType";
+
+ if (m.find()) {
+ gameType = m.group(GAME_TYPE_GROUP) + " ";
+ } else {
+ handConversionLog.warn("Gametype could not be parsed from history line: \"{}\"", singleHandHistoryLine);
+ }
+
String timeString = singleHandHistoryLine.substring(
singleHandHistoryLine.indexOf(DOUBLE_QUOTE + COMMA_CHAR) + 2, singleHandHistoryLine.lastIndexOf('.'));
timeString = timeString.replace("-", FORWARD_SLASH);
@@ -367,7 +380,7 @@ String convertSingleHand(String singleHandHistoryBase, long handIdPrefix) throws
String readHandNumber(String singleHandHistoryLine) {
return singleHandHistoryLine.substring(singleHandHistoryLine.indexOf(HAND_NUMBER_PREFIX_CHAR) + 1,
- singleHandHistoryLine.indexOf(" ", singleHandHistoryLine.indexOf(HAND_NUMBER_PREFIX_CHAR)));
+ singleHandHistoryLine.indexOf(" (id"));
}
String createConvertedHandSummary(String buttonPlayerName, String playerSummary, String smallBlindPlayerName,