FTP: Handle partial hhs in date function

This commit is contained in:
Worros 2011-02-07 23:22:17 +08:00
parent 391dea0b7e
commit 005dc9ba4c

View File

@ -89,7 +89,7 @@ class Fulltilt(HandHistoryConverter):
[%(LS)s]?(?P<CAP>[.0-9]+\sCap\s)? [%(LS)s]?(?P<CAP>[.0-9]+\sCap\s)?
(?P<GAMETYPE>[-\da-zA-Z\/\'\s]+)\s-\s (?P<GAMETYPE>[-\da-zA-Z\/\'\s]+)\s-\s
(?P<DATETIME>.*$) (?P<DATETIME>.*$)
(?P<PARTIAL>\(partial\))?\n (?P<PARTIAL>\(partial\))?\s
(?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))? (?:.*?\n(?P<CANCELLED>Hand\s\#(?P=HID)\shas\sbeen\scanceled))?
''' % substitutions, re.MULTILINE|re.VERBOSE) ''' % substitutions, re.MULTILINE|re.VERBOSE)
re_TourneyExtraInfo = re.compile('''(((?P<TOURNEY_NAME>[^$]+)? re_TourneyExtraInfo = re.compile('''(((?P<TOURNEY_NAME>[^$]+)?
@ -148,7 +148,7 @@ class Fulltilt(HandHistoryConverter):
re_Mixed = re.compile(r'\s\-\s(?P<MIXED>HA|HORSE|HOSE)\s\-\s', re.VERBOSE) re_Mixed = re.compile(r'\s\-\s(?P<MIXED>HA|HORSE|HOSE)\s\-\s', re.VERBOSE)
re_Max = re.compile("(?P<MAX>\d+)( max)?", re.MULTILINE) re_Max = re.compile("(?P<MAX>\d+)( max)?", re.MULTILINE)
# NB: if we ever match "Full Tilt Poker" we should also match "FullTiltPoker", which PT Stud erroneously exports. # NB: if we ever match "Full Tilt Poker" we should also match "FullTiltPoker", which PT Stud erroneously exports.
re_DateTime = re.compile("""((?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s(?P<TZ>\w+)\s-\s(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})|(?P<H2>[0-9]+):(?P<MIN2>[0-9]+)\s(?P<TZ2>\w+)\s-\s\w+\,\s(?P<M2>\w+)\s(?P<D2>\d+)\,\s(?P<Y2>[0-9]{4}))""", re.MULTILINE) re_DateTime = re.compile("""((?P<H>[0-9]+):(?P<MIN>[0-9]+):(?P<S>[0-9]+)\s(?P<TZ>\w+)\s-\s(?P<Y>[0-9]{4})\/(?P<M>[0-9]{2})\/(?P<D>[0-9]{2})|(?P<H2>[0-9]+):(?P<MIN2>[0-9]+)\s(?P<TZ2>\w+)\s-\s\w+\,\s(?P<M2>\w+)\s(?P<D2>\d+)\,\s(?P<Y2>[0-9]{4}))(?P<PARTIAL>\s\(partial\))?""", re.MULTILINE)
@ -284,10 +284,13 @@ class Fulltilt(HandHistoryConverter):
datetimestr = "%s/%s/%s %s:%s" % (a.group('Y2'), a.group('M2'),a.group('D2'),a.group('H2'),a.group('MIN2')) datetimestr = "%s/%s/%s %s:%s" % (a.group('Y2'), a.group('M2'),a.group('D2'),a.group('H2'),a.group('MIN2'))
timezone = a.group('TZ2') timezone = a.group('TZ2')
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%B/%d %H:%M") hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%B/%d %H:%M")
if a.group('PARTIAL'):
raise FpdbParseError(hid=m.group('HID'))
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, timezone, "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"):
# It would appear this can't be triggered as DATETIME is a bit greedy
raise FpdbParseError(hid=m.group('HID')) raise FpdbParseError(hid=m.group('HID'))
if m.group('TABLEATTRIBUTES'): if m.group('TABLEATTRIBUTES'):