Merge branch 'carl'

This commit is contained in:
steffen123 2010-07-29 14:39:34 +02:00
commit 5721b5b23c
2 changed files with 20 additions and 11 deletions

View File

@ -54,7 +54,7 @@ class Fulltilt(HandHistoryConverter):
\$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)\s(Ante\s\$?(?P<ANTE>[.0-9]+)\s)?-\s \$?(?P<SB>[.0-9]+)/\$?(?P<BB>[.0-9]+)\s(Ante\s\$?(?P<ANTE>[.0-9]+)\s)?-\s
\$?(?P<CAP>[.0-9]+\sCap\s)? \$?(?P<CAP>[.0-9]+\sCap\s)?
(?P<GAMETYPE>[a-zA-Z\/\'\s]+)\s-\s (?P<GAMETYPE>[a-zA-Z\/\'\s]+)\s-\s
(?P<DATETIME>\d+:\d+:\d+\s\w+\s-\s\d+/\d+/\d+|\d+:\d+\s\w+\s-\s\w+\,\s\w+\s\d+\,\s\d+) (?P<DATETIME>\d+:\d+:\d+\s(?P<TZ1>\w+)\s-\s\d+/\d+/\d+|\d+:\d+\s(?P<TZ2>\w+)\s-\s\w+\,\s\w+\s\d+\,\s\d+)
(?P<PARTIAL>\(partial\))?\n (?P<PARTIAL>\(partial\))?\n
(?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))? (?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))?
''', re.VERBOSE|re.DOTALL) ''', re.VERBOSE|re.DOTALL)
@ -202,12 +202,17 @@ class Fulltilt(HandHistoryConverter):
hand.handid = m.group('HID') hand.handid = m.group('HID')
hand.tablename = m.group('TABLE') hand.tablename = m.group('TABLE')
timezone = "ET"
if m.group('TZ1') == "CET" or m.group('TZ2') == "CET":
timezone = "CET"
try: try:
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M:%S ET - %Y/%m/%d") stringformat = "%H:%M:%S " + m.group('TZ1') + " - %Y/%m/%d"
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), stringformat)
except: except:
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), "%H:%M ET - %a, %B %d, %Y") stringformat = "%H:%M " + m.group('TZ2') + " - %a, %B %d, %Y"
hand.startTime = datetime.datetime.strptime(m.group('DATETIME'), stringformat)
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, "ET", "UTC") hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, timezone, "UTC")
if m.group("CANCELLED") or m.group("PARTIAL"): if m.group("CANCELLED") or m.group("PARTIAL"):
raise FpdbParseError(hid=m.group('HID')) raise FpdbParseError(hid=m.group('HID'))

View File

@ -497,6 +497,7 @@ or None if we fail to get the info """
@staticmethod @staticmethod
def changeTimezone(time, givenTimezone, wantedTimezone): def changeTimezone(time, givenTimezone, wantedTimezone):
offest = datetime.timedelta(hours=0)
if givenTimezone=="ET" and wantedTimezone=="UTC": if givenTimezone=="ET" and wantedTimezone=="UTC":
# approximate rules for ET daylight savings time: # approximate rules for ET daylight savings time:
if ( time.month == 12 # all of Dec if ( time.month == 12 # all of Dec
@ -506,9 +507,12 @@ or None if we fail to get the info """
offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving) offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving)
else: else:
offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving)
#print " tz = %s start = %s" % (tz, str(hand.starttime))
elif givenTimezone=="CET" and wantedTimezone=="UTC":
offset = datetime.timedelta(hours=1)
# adjust time into UTC: # adjust time into UTC:
time = time + offset time = time + offset
#print " tz = %s start = %s" % (tz, str(hand.starttime))
return time return time
#end @staticmethod def changeTimezone #end @staticmethod def changeTimezone