Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

usable hand history generators #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ room.conf
dump_schema.sh
log/room.log
_trial*
META.yml
Makefile
blib/
6 changes: 3 additions & 3 deletions lib/ppn/pokernetwork/pokerdatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, settings):
user = self.parameters["user"],
passwd = self.parameters["password"],
db = self.parameters["name"],
reconnect = 1)
)
if self.verbose > 2:
self.message("MySQL server version is " + self.db.get_server_info())
except:
Expand All @@ -60,7 +60,7 @@ def __init__(self, settings):
port = int(self.parameters.get("port", '3306')),
user = self.parameters["root_user"],
passwd = self.parameters["root_password"],
reconnect = 1)
)
if self.verbose:
self.message("MySQL server version is " + db.get_server_info())
if int(db.get_server_info().split('.')[0]) < 5:
Expand Down Expand Up @@ -120,7 +120,7 @@ def __init__(self, settings):
user = self.parameters["user"],
passwd = self.parameters["password"],
db = self.parameters["name"],
reconnect = 1)
)

if self.verbose:
self.message("PokerDatabase: Database connection to %s/%s open" % ( self.parameters["host"], self.parameters["name"] ))
Expand Down
19 changes: 19 additions & 0 deletions lib/ppn/pokernetwork/pokerservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,25 @@ def loadHand(self, hand_serial):
print_exc()
return None

def getHandTimestamp(self, hand_serial):
cursor = self.db.cursor()
sql = """SELECT UNIX_TIMESTAMP(hands.created) as hand_timestamp
FROM `hands` WHERE `serial`=%s"""
cursor.execute(sql, (hand_serial,))
(hand_timestamp,) = cursor.fetchone()
cursor.close()
return hand_timestamp

def getPlayerNamesFromHand(self, hand_serial):
cursor = self.db.cursor()
sql = """SELECT user2hand.user_serial as player_id, users.name
FROM user2hand, users WHERE user2hand.hand_serial=%s AND
users.serial=user2hand.user_serial"""
cursor.execute(sql, (hand_serial,))
player_names = cursor.fetchall()
cursor.close()
return dict(player_names)

def saveHand(self, description, hand_serial):
(type, level, hand_serial, hands_count, time, variant, betting_structure, player_list, dealer, serial2chips) = description[0]
cursor = self.db.cursor()
Expand Down
Loading