summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--src/bcdd/PBNBoard.py5
-rw-r--r--src/main.py7
3 files changed, 12 insertions, 3 deletions
diff --git a/README.md b/README.md
index 9056106..db96b22 100644
--- a/README.md
+++ b/README.md
@@ -50,8 +50,7 @@ Quirks, assumptions and known issues
====================================
* one only section within the PBN is supported: table number (`[Table "XX"]`) is stripped of any section letters and converted to numerical value that must match the table number in Teamy database
- * LoveBridge exports seem to indicated double in the `[Contract ""]` field by `*`, not `x` - both notations are supported
- * there's no support for initial lead card, hopefully: yet; when it comes, it's most likely going to be in a non-standard PBN field
+ * LoveBridge exports seem to indicate double in the `[Contract ""]` field by `*`, not `x` - both notations are supported
* bidding data is always overwriting values in the database
* lineups, if requested, are always overwriting values in the database
* if the records for specific boards are missing from the `scores` table in event database (as in, JFR Webmaster haven't created them yet), they are created
diff --git a/src/bcdd/PBNBoard.py b/src/bcdd/PBNBoard.py
index 6e1abf6..e76252d 100644
--- a/src/bcdd/PBNBoard.py
+++ b/src/bcdd/PBNBoard.py
@@ -166,6 +166,11 @@ class PBNBoard(object):
def get_auction(self):
return self.get_extended_raw_field('Auction', with_header=True)
+ def get_play_data(self):
+ if self.has_field('Play'):
+ return self.get_extended_raw_field('Play', with_header=False)
+ return None
+
def get_extended_raw_field(self, field_name, with_header=False):
field_found = False
result = []
diff --git a/src/main.py b/src/main.py
index 20b81f6..e90360b 100644
--- a/src/main.py
+++ b/src/main.py
@@ -148,11 +148,16 @@ def get_pbn_score(b):
contract = contract[0] + ' ' + contract[1:]
result = int(b.get_field('Result')) - get_digits(contract) - 6
score = int(b.get_field('Score').replace('NS ', '')) # co z pasami?
+ play_data = b.get_play_data()
+ if play_data:
+ play_data = ' '.join(play_data).split(' ')
+ if play_data:
+ lead = play_data[0].strip()
+ lead = lead[0] + ' ' + lead[1]
else: # passed-out hand
contract = contract.upper()
result = 0
score = 0
- lead = '' # wtf?
return declarer, contract, result, score, lead