Merge branch 'master' of git://git.assembla.com/fpdb-eric
This commit is contained in:
commit
66fe3f990b
|
@ -28,7 +28,7 @@ import codecs
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import operator
|
import operator
|
||||||
from xml.dom.minidom import Node
|
from xml.dom.minidom import Node
|
||||||
from pokereval import PokerEval
|
# from pokereval import PokerEval
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -74,7 +74,7 @@ gettext.install('myapplication')
|
||||||
|
|
||||||
|
|
||||||
class HandHistoryConverter:
|
class HandHistoryConverter:
|
||||||
eval = PokerEval()
|
# eval = PokerEval()
|
||||||
def __init__(self, config, file, sitename):
|
def __init__(self, config, file, sitename):
|
||||||
print "HandHistory init called"
|
print "HandHistory init called"
|
||||||
self.c = config
|
self.c = config
|
||||||
|
|
|
@ -59,6 +59,7 @@ class Importer:
|
||||||
self.cursor = None
|
self.cursor = None
|
||||||
self.filelist = {}
|
self.filelist = {}
|
||||||
self.dirlist = {}
|
self.dirlist = {}
|
||||||
|
self.addToDirList = {}
|
||||||
self.monitor = False
|
self.monitor = False
|
||||||
self.updated = {} #Time last import was run {file:mtime}
|
self.updated = {} #Time last import was run {file:mtime}
|
||||||
self.lines = None
|
self.lines = None
|
||||||
|
@ -180,18 +181,33 @@ class Importer:
|
||||||
self.updated[file] = time()
|
self.updated[file] = time()
|
||||||
# This codepath only runs first time the file is found, if modified in the last
|
# This codepath only runs first time the file is found, if modified in the last
|
||||||
# minute run an immediate import.
|
# minute run an immediate import.
|
||||||
if (time() - stat_info.st_mtime) < 60: # TODO: figure out a way to dispatch this to the seperate thread so our main window doesn't lock up on initial import
|
if (time() - stat_info.st_mtime) < 60 or os.path.isdir(file): # TODO: figure out a way to dispatch this to the seperate thread so our main window doesn't lock up on initial import
|
||||||
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||||
|
|
||||||
|
for dir in self.addToDirList:
|
||||||
|
self.addImportDirectory(dir, True, self.addToDirList[dir][0], self.addToDirList[dir][1])
|
||||||
|
|
||||||
|
self.addToDirList = {}
|
||||||
|
|
||||||
# This is now an internal function that should not be called directly.
|
# This is now an internal function that should not be called directly.
|
||||||
def import_file_dict(self, file, site, filter):
|
def import_file_dict(self, file, site, filter):
|
||||||
if(filter == "passthrough"):
|
if os.path.isdir(file):
|
||||||
|
self.addToDirList[file] = [site] + [filter]
|
||||||
|
return
|
||||||
|
if filter == "passthrough" or filter == "":
|
||||||
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site)
|
(stored, duplicates, partial, errors, ttime) = self.import_fpdb_file(file, site)
|
||||||
else:
|
else:
|
||||||
conv = None
|
conv = None
|
||||||
# Load filter, process file, pass returned filename to import_fpdb_file
|
# Load filter, process file, pass returned filename to import_fpdb_file
|
||||||
if(filter == "EverleafToFpdb"):
|
|
||||||
conv = EverleafToFpdb(self.config, file)
|
# TODO: Shouldn't we be able to use some sort of lambda or something to just call a Python object by whatever name we specify? then we don't have to hardcode them,
|
||||||
|
# someone can just create their own python module for it
|
||||||
|
if filter == "EverleafToFpdb":
|
||||||
|
print "converting ", file
|
||||||
|
conv = EverleafToFpdb.Everleaf(self.config, file)
|
||||||
|
else:
|
||||||
|
print "Unknown filter ", filter
|
||||||
|
return
|
||||||
|
|
||||||
supp = conv.readSupportedGames() # Should this be done by HHC on init?
|
supp = conv.readSupportedGames() # Should this be done by HHC on init?
|
||||||
gt = conv.determineGameType()
|
gt = conv.determineGameType()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user