Merge branch 'master' of git://git.assembla.com/fpdb-eric
Conflicts: pyfpdb/Configuration.py
This commit is contained in:
commit
9923e6e8ca
|
@ -57,6 +57,7 @@ class Site:
|
|||
self.hudbgcolor = node.getAttribute("bgcolor")
|
||||
self.hudfgcolor = node.getAttribute("fgcolor")
|
||||
self.converter = node.getAttribute("converter")
|
||||
self.enabled = node.getAttribute("enabled")
|
||||
self.layout = {}
|
||||
|
||||
for layout_node in node.getElementsByTagName('layout'):
|
||||
|
@ -498,13 +499,14 @@ class Config:
|
|||
parms["table_finder"] = self.supported_sites[site].table_finder
|
||||
parms["HH_path"] = self.supported_sites[site].HH_path
|
||||
parms["site_name"] = self.supported_sites[site].site_name
|
||||
parms["enabled"] = self.supported_sites[site].enabled
|
||||
return parms
|
||||
|
||||
def set_site_parameters(self, site_name, converter = None, decoder = None,
|
||||
hudbgcolor = None, hudfgcolor = None,
|
||||
hudopacity = None, screen_name = None,
|
||||
site_path = None, table_finder = None,
|
||||
HH_path = None):
|
||||
HH_path = None, enabled = None):
|
||||
"""Sets the specified site parameters for the specified site."""
|
||||
site_node = self.get_site_node(site_name)
|
||||
if not db_node == None:
|
||||
|
@ -517,6 +519,7 @@ class Config:
|
|||
if not site_path == None: site_node.setAttribute("site_path", site_path)
|
||||
if not table_finder == None: site_node.setAttribute("table_finder", table_finder)
|
||||
if not HH_path == None: site_node.setAttribute("HH_path", HH_path)
|
||||
if not enabled == None: site_node.setAttribute("enabled", enabled)
|
||||
|
||||
if self.supported_databases.has_key(db_name):
|
||||
if not converter == None: self.supported_sites[site].converter = converter
|
||||
|
@ -528,6 +531,7 @@ class Config:
|
|||
if not site_path == None: self.supported_sites[site].site_path = site_path
|
||||
if not table_finder == None: self.supported_sites[site].table_finder = table_finder
|
||||
if not HH_path == None: self.supported_sites[site].HH_path = HH_path
|
||||
if not enabled == None: self.supported_sites[site].enabled = enabled
|
||||
return
|
||||
|
||||
if __name__== "__main__":
|
||||
|
|
40
pyfpdb/EverleafToFpdb.py
Normal file
40
pyfpdb/EverleafToFpdb.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python
|
||||
# Copyright 2008, Carl Gherardi
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
########################################################################
|
||||
|
||||
from HandHistoryConverter import HandHistoryConverter
|
||||
|
||||
class Everleaf(HandHistoryConverter):
|
||||
def __init__(self):
|
||||
print "Initialising Everleaf converter class"
|
||||
def readSupportedGames(self):
|
||||
pass
|
||||
|
||||
def determineGameType(self):
|
||||
pass
|
||||
|
||||
def readPlayerStacks(self):
|
||||
pass
|
||||
|
||||
def readBlinds(self):
|
||||
pass
|
||||
|
||||
def readAction(self):
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
e = Everleaf()
|
|
@ -26,11 +26,56 @@ import os
|
|||
import time
|
||||
import fpdb_import
|
||||
|
||||
|
||||
class GuiAutoImport (threading.Thread):
|
||||
def starsBrowseClicked(self, widget, data):
|
||||
"""runs when user clicks browse on auto import tab"""
|
||||
#print "start of GuiAutoImport.starsBrowseClicked"
|
||||
current_path=self.starsDirPath.get_text()
|
||||
def __init__(self, settings, config):
|
||||
"""Constructor for GuiAutoImport"""
|
||||
self.settings=settings
|
||||
self.config=config
|
||||
|
||||
self.input_settings = {}
|
||||
|
||||
self.importer = fpdb_import.Importer(self,self.settings)
|
||||
self.importer.setCallHud(True)
|
||||
self.importer.setMinPrint(30)
|
||||
self.importer.setQuiet(False)
|
||||
self.importer.setFailOnError(False)
|
||||
self.importer.setHandCount(0)
|
||||
# self.importer.setWatchTime()
|
||||
|
||||
self.server=settings['db-host']
|
||||
self.user=settings['db-user']
|
||||
self.password=settings['db-password']
|
||||
self.database=settings['db-databaseName']
|
||||
|
||||
self.mainVBox=gtk.VBox(False,1)
|
||||
self.mainVBox.show()
|
||||
|
||||
self.settingsHBox = gtk.HBox(False, 0)
|
||||
self.mainVBox.pack_start(self.settingsHBox, False, True, 0)
|
||||
self.settingsHBox.show()
|
||||
|
||||
self.intervalLabel = gtk.Label("Interval (ie. break) between imports in seconds:")
|
||||
self.settingsHBox.pack_start(self.intervalLabel)
|
||||
self.intervalLabel.show()
|
||||
|
||||
self.intervalEntry=gtk.Entry()
|
||||
self.intervalEntry.set_text(str(self.settings['hud-defaultInterval']))
|
||||
self.settingsHBox.pack_start(self.intervalEntry)
|
||||
self.intervalEntry.show()
|
||||
|
||||
self.addSites(self.mainVBox)
|
||||
|
||||
self.startButton=gtk.Button("Start Autoimport")
|
||||
self.startButton.connect("clicked", self.startClicked, "start clicked")
|
||||
self.mainVBox.add(self.startButton)
|
||||
self.startButton.show()
|
||||
|
||||
|
||||
#end of GuiAutoImport.__init__
|
||||
def browseClicked(self, widget, data):
|
||||
"""runs when user clicks one of the browse buttons in the auto import tab"""
|
||||
current_path=data[1].get_text()
|
||||
|
||||
dia_chooser = gtk.FileChooserDialog(title="Please choose the path that you want to auto import",
|
||||
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
|
@ -42,32 +87,12 @@ class GuiAutoImport (threading.Thread):
|
|||
response = dia_chooser.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
#print dia_chooser.get_filename(), 'selected'
|
||||
self.starsDirPath.set_text(dia_chooser.get_filename())
|
||||
data[1].set_text(dia_chooser.get_filename())
|
||||
self.input_settings[data[0]][0] = dia_chooser.get_filename()
|
||||
elif response == gtk.RESPONSE_CANCEL:
|
||||
print 'Closed, no files selected'
|
||||
dia_chooser.destroy()
|
||||
#end def GuiAutoImport.starsBrowseClicked
|
||||
|
||||
def tiltBrowseClicked(self, widget, data):
|
||||
"""runs when user clicks browse on auto import tab"""
|
||||
#print "start of GuiAutoImport.tiltBrowseClicked"
|
||||
current_path=self.tiltDirPath.get_text()
|
||||
|
||||
dia_chooser = gtk.FileChooserDialog(title="Please choose the path that you want to auto import",
|
||||
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
||||
#dia_chooser.set_current_folder(pathname)
|
||||
dia_chooser.set_filename(current_path)
|
||||
#dia_chooser.set_select_multiple(select_multiple) #not in tv, but want this in bulk import
|
||||
|
||||
response = dia_chooser.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
#print dia_chooser.get_filename(), 'selected'
|
||||
self.tiltDirPath.set_text(dia_chooser.get_filename())
|
||||
elif response == gtk.RESPONSE_CANCEL:
|
||||
print 'Closed, no files selected'
|
||||
dia_chooser.destroy()
|
||||
#end def GuiAutoImport.tiltBrowseClicked
|
||||
#end def GuiAutoImport.browseClicked
|
||||
|
||||
def do_import(self):
|
||||
"""Callback for timer to do an import iteration."""
|
||||
|
@ -106,12 +131,11 @@ class GuiAutoImport (threading.Thread):
|
|||
# command = command + " %s" % (self.database)
|
||||
# print "command = ", command
|
||||
# self.pipe_to_hud = os.popen(command, 'w')
|
||||
self.starspath=self.starsDirPath.get_text()
|
||||
self.tiltpath=self.tiltDirPath.get_text()
|
||||
|
||||
# Add directory to importer object.
|
||||
self.importer.addImportDirectory(self.starspath, True, "PokerStars", "passthrough")
|
||||
self.importer.addImportDirectory(self.tiltpath, True, "FullTilt", "passthrough")
|
||||
# Add directories to importer object.
|
||||
for site in self.input_settings:
|
||||
self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1])
|
||||
print "Adding import directories - Site: " + site + " dir: "+ str(self.input_settings[site][0])
|
||||
self.do_import()
|
||||
|
||||
interval=int(self.intervalEntry.get_text())
|
||||
|
@ -123,78 +147,44 @@ class GuiAutoImport (threading.Thread):
|
|||
return self.mainVBox
|
||||
#end def get_vbox
|
||||
|
||||
def __init__(self, settings, config, debug=True):
|
||||
"""Constructor for GuiAutoImport"""
|
||||
self.settings=settings
|
||||
self.config=config
|
||||
self.importer = fpdb_import.Importer(self,self.settings)
|
||||
self.importer.setCallHud(True)
|
||||
self.importer.setMinPrint(30)
|
||||
self.importer.setQuiet(False)
|
||||
self.importer.setFailOnError(False)
|
||||
self.importer.setHandCount(0)
|
||||
# self.importer.setWatchTime()
|
||||
#Create the site line given required info and setup callbacks
|
||||
#enabling and disabling sites from this interface not possible
|
||||
#expects a box to layout the line horizontally
|
||||
def createSiteLine(self, hbox, site, iconpath, hhpath, filter_name, active = True):
|
||||
label = gtk.Label(site + " auto-import:")
|
||||
hbox.pack_start(label, False, False, 0)
|
||||
label.show()
|
||||
|
||||
self.server=settings['db-host']
|
||||
self.user=settings['db-user']
|
||||
self.password=settings['db-password']
|
||||
self.database=settings['db-databaseName']
|
||||
dirPath=gtk.Entry()
|
||||
dirPath.set_text(hhpath)
|
||||
hbox.pack_start(dirPath, False, True, 0)
|
||||
dirPath.show()
|
||||
|
||||
self.mainVBox=gtk.VBox(False,1)
|
||||
self.mainVBox.show()
|
||||
browseButton=gtk.Button("Browse...")
|
||||
browseButton.connect("clicked", self.browseClicked, [site] + [dirPath])
|
||||
hbox.pack_start(browseButton, False, False, 0)
|
||||
browseButton.show()
|
||||
|
||||
self.settingsHBox = gtk.HBox(False, 0)
|
||||
self.mainVBox.pack_start(self.settingsHBox, False, True, 0)
|
||||
self.settingsHBox.show()
|
||||
label = gtk.Label(site + " filter:")
|
||||
hbox.pack_start(label, False, False, 0)
|
||||
label.show()
|
||||
|
||||
self.intervalLabel = gtk.Label("Interval (ie. break) between imports in seconds:")
|
||||
self.settingsHBox.pack_start(self.intervalLabel)
|
||||
self.intervalLabel.show()
|
||||
filter=gtk.Entry()
|
||||
filter.set_text(filter_name)
|
||||
hbox.pack_start(filter, False, True, 0)
|
||||
filter.show()
|
||||
|
||||
self.intervalEntry=gtk.Entry()
|
||||
self.intervalEntry.set_text(str(self.settings['hud-defaultInterval']))
|
||||
self.settingsHBox.pack_start(self.intervalEntry)
|
||||
self.intervalEntry.show()
|
||||
def addSites(self, vbox):
|
||||
for site in self.config.supported_sites.keys():
|
||||
pathHBox = gtk.HBox(False, 0)
|
||||
vbox.pack_start(pathHBox, False, True, 0)
|
||||
pathHBox.show()
|
||||
|
||||
self.pathHBox = gtk.HBox(False, 0)
|
||||
self.mainVBox.pack_start(self.pathHBox, False, True, 0)
|
||||
self.pathHBox.show()
|
||||
paths = self.config.get_default_paths(site)
|
||||
params = self.config.get_site_parameters(site)
|
||||
self.createSiteLine(pathHBox, site, False, paths['hud-defaultPath'], params['converter'], params['enabled'])
|
||||
self.input_settings[site] = [paths['hud-defaultPath']] + [params['converter']]
|
||||
|
||||
self.pathStarsLabel = gtk.Label("Path to PokerStars auto-import:")
|
||||
self.pathHBox.pack_start(self.pathStarsLabel, False, False, 0)
|
||||
self.pathStarsLabel.show()
|
||||
|
||||
self.starsDirPath=gtk.Entry()
|
||||
paths = self.config.get_default_paths("PokerStars")
|
||||
self.starsDirPath.set_text(paths['hud-defaultPath'])
|
||||
self.pathHBox.pack_start(self.starsDirPath, False, True, 0)
|
||||
self.starsDirPath.show()
|
||||
|
||||
self.browseButton=gtk.Button("Browse...")
|
||||
self.browseButton.connect("clicked", self.starsBrowseClicked, "Browse clicked")
|
||||
self.pathHBox.pack_start(self.browseButton, False, False, 0)
|
||||
self.browseButton.show()
|
||||
|
||||
self.pathTiltLabel = gtk.Label("Path to Full Tilt auto-import:")
|
||||
self.pathHBox.pack_start(self.pathTiltLabel, False, False, 0)
|
||||
self.pathTiltLabel.show()
|
||||
|
||||
self.tiltDirPath=gtk.Entry()
|
||||
paths = self.config.get_default_paths("Full Tilt")
|
||||
self.tiltDirPath.set_text(paths['hud-defaultPath'])
|
||||
self.pathHBox.pack_start(self.tiltDirPath, False, True, 0)
|
||||
self.tiltDirPath.show()
|
||||
|
||||
self.browseButton=gtk.Button("Browse...")
|
||||
self.browseButton.connect("clicked", self.tiltBrowseClicked, "Browse clicked")
|
||||
self.pathHBox.pack_start(self.browseButton, False, False, 0)
|
||||
self.browseButton.show()
|
||||
|
||||
self.startButton=gtk.Button("Start Autoimport")
|
||||
self.startButton.connect("clicked", self.startClicked, "start clicked")
|
||||
self.mainVBox.add(self.startButton)
|
||||
self.startButton.show()
|
||||
#end of GuiAutoImport.__init__
|
||||
if __name__== "__main__":
|
||||
def destroy(*args): # call back for terminating the main eventloop
|
||||
gtk.main_quit()
|
||||
|
|
|
@ -64,19 +64,22 @@ class GuiGraphViewer (threading.Thread):
|
|||
#Set graph properties
|
||||
self.ax = self.fig.add_subplot(111)
|
||||
|
||||
#
|
||||
#Get graph data from DB
|
||||
line = self.getRingProfitGraph(name, site)
|
||||
|
||||
self.ax.set_title("Profit graph for ring games")
|
||||
|
||||
#Set axis labels and grid overlay properites
|
||||
self.ax.set_xlabel("Hands", fontsize = 12)
|
||||
self.ax.set_ylabel("$", fontsize = 12)
|
||||
self.ax.grid(color='g', linestyle=':', linewidth=0.2)
|
||||
text = "All Hands, " + sitename + str(name)
|
||||
text = "All Hands, " + sitename + str(name) + "\nProfit: $" + str(line[-1]) + "\nTotal Hands: " + str(len(line))
|
||||
|
||||
self.ax.annotate (text, (61,25), xytext =(0.1, 0.9) , textcoords ="axes fraction" ,)
|
||||
self.ax.annotate(text, xy=(10, -10),
|
||||
xycoords='axes points',
|
||||
horizontalalignment='left', verticalalignment='top',
|
||||
fontsize=10)
|
||||
|
||||
#Get graph data from DB
|
||||
line = self.getRingProfitGraph(name, site)
|
||||
|
||||
#Draw plot
|
||||
self.ax.plot(line,)
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
<location seat="9" x="70" y="53"> </location>
|
||||
</layout>
|
||||
</site>
|
||||
<site enabled="False" site_name="Everleaf" table_finder="Poker.exe" screen_name="DO NOT NEED THIS YET" site_path="" HH_path="" decoder="Unknown" converter="EverleafToFpdb" supported_games="holdem,razz,omahahi,omahahilo,studhi" fgcolor="#48D1CC" bgcolor="#000000">
|
||||
<site enabled="False" site_name="Everleaf" table_finder="Poker.exe" screen_name="DO NOT NEED THIS YET" site_path="" HH_path="" decoder="Unknown" converter="EverleafToFpdb" supported_games="holdem,razz,omahahi,omahahilo,studhi" fgcolor="#48D1CC" bgcolor="#000000" opacity="0.75">
|
||||
<layout fav_seat="0" height="546" max="6" width="792">
|
||||
<location seat="1" x="581" y="109"> </location>
|
||||
<location seat="2" x="605" y="287"> </location>
|
||||
|
|
35
pyfpdb/HandHistoryConverter.py
Normal file
35
pyfpdb/HandHistoryConverter.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
#Copyright 2008 Carl Gherardi
|
||||
#This program is free software: you can redistribute it and/or modify
|
||||
#it under the terms of the GNU Affero General Public License as published by
|
||||
#the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
#This program is distributed in the hope that it will be useful,
|
||||
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
#GNU General Public License for more details.
|
||||
#
|
||||
#You should have received a copy of the GNU Affero General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#In the "official" distribution you can find the license in
|
||||
#agpl-3.0.txt in the docs folder of the package.
|
||||
|
||||
class HandHistoryConverter:
|
||||
def __init__(self):
|
||||
pass
|
||||
# Functions to be implemented in the inheriting class
|
||||
def readSupportedGames(self): abstract
|
||||
def determineGameType(self): abstract
|
||||
def readPlayerStacks(self): abstract
|
||||
def readBlinds(self): abstract
|
||||
def readAction(self): abstract
|
||||
|
||||
# Functions not necessary to implement in sub class
|
||||
def readFile(self, filename):
|
||||
"""Read file"""
|
||||
|
||||
def writeStars(self):
|
||||
"""Write out parsed data"""
|
||||
|
||||
|
|
@ -68,10 +68,12 @@ class Hud:
|
|||
self.main_window.set_title(table.name + " FPDBHUD")
|
||||
self.main_window.connect("destroy", self.kill_hud)
|
||||
self.main_window.set_decorated(False)
|
||||
self.main_window.set_opacity(self.colors["hudopacity"])
|
||||
#self.main_window.set_transient_for(parent.get_toplevel())
|
||||
|
||||
self.ebox = gtk.EventBox()
|
||||
self.label = gtk.Label("Right click to close HUD for %s\nor Save Stat Positions." % (table.name))
|
||||
# self.label = gtk.Label("Right click to close HUD for %s\nor Save Stat Positions." % (table.name))
|
||||
self.label = gtk.Label("FPDB Menu (Right Click)\nLeft-drag to move")
|
||||
|
||||
self.label.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudbgcolor']))
|
||||
self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(self.colors['hudfgcolor']))
|
||||
|
@ -111,18 +113,21 @@ class Hud:
|
|||
self.main_window.set_destroy_with_parent(True)
|
||||
|
||||
def on_button_press(self, widget, event):
|
||||
if event.button == 1:
|
||||
self.main_window.begin_move_drag(event.button, int(event.x_root), int(event.y_root), event.time)
|
||||
return True
|
||||
if event.button == 3:
|
||||
widget.popup(None, None, None, event.button, event.time)
|
||||
return True
|
||||
return False
|
||||
|
||||
def kill_hud(self, args):
|
||||
def kill_hud(self, *args):
|
||||
for k in self.stat_windows.keys():
|
||||
self.stat_windows[k].window.destroy()
|
||||
self.main_window.destroy()
|
||||
self.deleted = True
|
||||
|
||||
def reposition_windows(self, args):
|
||||
def reposition_windows(self, *args):
|
||||
for w in self.stat_windows:
|
||||
self.stat_windows[w].window.move(self.stat_windows[w].x,
|
||||
self.stat_windows[w].y)
|
||||
|
@ -259,7 +264,8 @@ class Stat_Window:
|
|||
# This handles all callbacks from button presses on the event boxes in
|
||||
# the stat windows. There is a bit of an ugly kludge to separate single-
|
||||
# and double-clicks.
|
||||
if event.button == 1: # left button event
|
||||
|
||||
if event.button == 3: # right button event
|
||||
if event.type == gtk.gdk.BUTTON_PRESS: # left button single click
|
||||
if self.sb_click > 0: return
|
||||
self.sb_click = gobject.timeout_add(250, self.single_click, widget)
|
||||
|
@ -270,12 +276,14 @@ class Stat_Window:
|
|||
self.double_click(widget, event, *args)
|
||||
|
||||
if event.button == 2: # middle button event
|
||||
pass
|
||||
# print "middle button clicked"
|
||||
|
||||
if event.button == 3: # right button event
|
||||
pass
|
||||
# print "right button clicked"
|
||||
|
||||
if event.button == 1: # left button event
|
||||
if event.state & gtk.gdk.SHIFT_MASK:
|
||||
self.window.begin_resize_drag(gtk.gdk.WINDOW_EDGE_SOUTH_EAST, event.button, int(event.x_root), int(event.y_root), event.time)
|
||||
else:
|
||||
self.window.begin_move_drag(event.button, int(event.x_root), int(event.y_root), event.time)
|
||||
|
||||
def single_click(self, widget):
|
||||
# Callback from the timeout in the single-click finding part of the
|
||||
|
@ -349,8 +357,9 @@ class Stat_Window:
|
|||
# font = pango.FontDescription("Sans 8")
|
||||
self.label[r][c].modify_font(font)
|
||||
|
||||
if not os.name == 'nt': # seems to be a bug in opacity on windows
|
||||
# if not os.name == 'nt': # seems to be a bug in opacity on windows
|
||||
self.window.set_opacity(parent.colors['hudopacity'])
|
||||
|
||||
self.window.realize
|
||||
self.window.move(self.x, self.y)
|
||||
self.window.show_all()
|
||||
|
@ -457,7 +466,7 @@ class Popup_window:
|
|||
self.lab.set_text(pu_text)
|
||||
self.window.show_all()
|
||||
|
||||
self.window.set_transient_for(stat_window.main_window)
|
||||
self.window.set_transient_for(stat_window.window)
|
||||
|
||||
# set_keep_above(1) for windows
|
||||
if os.name == 'nt': self.topify_window(self.window)
|
||||
|
|
|
@ -47,6 +47,7 @@ class fpdb_db:
|
|||
else:
|
||||
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
|
||||
self.cursor=self.db.cursor()
|
||||
self.cursor.execute('SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED')
|
||||
# Set up query dictionary as early in the connection process as we can.
|
||||
self.sql = FpdbSQLQueries.FpdbSQLQueries(self.get_backend_name())
|
||||
self.wrongDbVersion=False
|
||||
|
|
|
@ -128,7 +128,7 @@ class Importer:
|
|||
#Run full import on filelist
|
||||
def runImport(self):
|
||||
for file in self.filelist:
|
||||
self.import_file_dict(file)
|
||||
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||
|
||||
#Run import on updated files, then store latest update time.
|
||||
def runUpdated(self):
|
||||
|
@ -143,17 +143,25 @@ class Importer:
|
|||
try:
|
||||
lastupdate = self.updated[file]
|
||||
if stat_info.st_mtime > lastupdate:
|
||||
self.import_file_dict(file)
|
||||
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||
self.updated[file] = time()
|
||||
except:
|
||||
self.updated[file] = time()
|
||||
# This codepath only runs first time the file is found, if modified in the last
|
||||
# minute run an immediate import.
|
||||
if (time() - stat_info.st_mtime) < 60:
|
||||
self.import_file_dict(file)
|
||||
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||
|
||||
# This is now an internal function that should not be called directly.
|
||||
def import_file_dict(self, file):
|
||||
def import_file_dict(self, file, site, filter):
|
||||
if(filter == "passthrough"):
|
||||
self.import_fpdb_file(file, site)
|
||||
else:
|
||||
#Load filter, and run filtered file though main importer
|
||||
self.import_fpdb_file(file, site)
|
||||
|
||||
|
||||
def import_fpdb_file(self, file, site):
|
||||
starttime = time()
|
||||
last_read_hand=0
|
||||
loc = 0
|
||||
|
@ -170,7 +178,11 @@ class Importer:
|
|||
self.pos_in_file[file] = inputFile.tell()
|
||||
inputFile.close()
|
||||
|
||||
try: # sometimes we seem to be getting an empty self.lines, in which case, we just want to return.
|
||||
firstline = self.lines[0]
|
||||
except:
|
||||
# print "import_fpdb_file", file, site, self.lines, "\n"
|
||||
return
|
||||
|
||||
if firstline.find("Tournament Summary")!=-1:
|
||||
print "TODO: implement importing tournament summaries"
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 48 KiB |
Loading…
Reference in New Issue
Block a user