diff --git a/pyfpdb/ImapSummaries.py b/pyfpdb/ImapSummaries.py index 3e17d068..4f8813dd 100755 --- a/pyfpdb/ImapSummaries.py +++ b/pyfpdb/ImapSummaries.py @@ -33,6 +33,7 @@ def run(config, db): #print "start of IS.run" server=None #try: + #print "useSSL",config.email.useSsl,"host",config.email.host if config.email.useSsl: server = IMAP4_SSL(config.email.host) else: diff --git a/pyfpdb/PokerStarsSummary.py b/pyfpdb/PokerStarsSummary.py index 40b235d0..6640daa9 100644 --- a/pyfpdb/PokerStarsSummary.py +++ b/pyfpdb/PokerStarsSummary.py @@ -20,7 +20,7 @@ from decimal import Decimal import datetime -from PokerStarsToFpdb import PokerStars +import PokerStarsToFpdb from TourneySummary import * class PokerStarsSummary(TourneySummary): @@ -58,6 +58,7 @@ class PokerStarsSummary(TourneySummary): result=result.groupdict() datetimestr = "%s/%s/%s %s:%s:%s" % (result['Y'], result['M'],result['D'],result['H'],result['MIN'],result['S']) self.startTime= datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET" + self.startTime = PokerStarsToFpdb.removeET(self.startTime) result=self.re_DateTime.search(lines[5]) result=result.groupdict() diff --git a/pyfpdb/PokerStarsToFpdb.py b/pyfpdb/PokerStarsToFpdb.py index e85ee191..2beeb286 100644 --- a/pyfpdb/PokerStarsToFpdb.py +++ b/pyfpdb/PokerStarsToFpdb.py @@ -26,6 +26,21 @@ from decimal import Decimal # PokerStars HH Format +def removeET(time): + # approximate rules for ET daylight savings time: + if ( time.month == 12 # all of Dec + or (time.month == 11 and time.day > 4) # and most of November + or time.month < 3 # and all of Jan/Feb + or (time.month == 3 and time.day < 11) ): # and 1st 10 days of March + offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving) + else: + offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) + # adjust time into UTC: + time = time + offset + #print " tz = %s start = %s" % (tz, str(hand.starttime)) + return time +#end def removeET + class PokerStars(HandHistoryConverter): # Class Variables @@ -227,7 +242,7 @@ class PokerStars(HandHistoryConverter): #tz = a.group('TZ') # just assume ET?? #print " tz = ", tz, " datetime =", datetimestr hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%m/%d %H:%M:%S") # also timezone at end, e.g. " ET" - self.removeET(hand) + hand.startTime = removeET(hand.startTime) if key == 'HID': hand.handid = info[key] if key == 'TOURNO': @@ -268,20 +283,6 @@ class PokerStars(HandHistoryConverter): # hand.currency = 'play' # overrides previously set value hand.gametype['currency'] = 'play' - def removeET(self, hand): - # approximate rules for ET daylight savings time: - if ( hand.startTime.month == 12 # all of Dec - or (hand.startTime.month == 11 and hand.starttime.day > 4) # and most of November - or hand.startTime.month < 3 # and all of Jan/Feb - or (hand.startTime.month == 3 and hand.starttime.day < 11) ): # and 1st 10 days of March - offset = datetime.timedelta(hours=5) # are EST: assume 5 hour offset (ET without daylight saving) - else: - offset = datetime.timedelta(hours=4) # rest is EDT: assume 4 hour offset (ET with daylight saving) - # adjust time into UTC: - hand.startTime = hand.startTime + offset - #print " tz = %s start = %s" % (tz, str(hand.starttime)) - #end def removeET - def readButton(self, hand): m = self.re_Button.search(hand.handText) if m: