remove hharchivebase from code and test config
This commit is contained in:
parent
22fdf6944b
commit
43b071515d
|
@ -485,7 +485,6 @@ class Import:
|
||||||
self.node = node
|
self.node = node
|
||||||
self.interval = node.getAttribute("interval")
|
self.interval = node.getAttribute("interval")
|
||||||
self.callFpdbHud = node.getAttribute("callFpdbHud")
|
self.callFpdbHud = node.getAttribute("callFpdbHud")
|
||||||
self.hhArchiveBase = node.getAttribute("hhArchiveBase")
|
|
||||||
self.ResultsDirectory = node.getAttribute("ResultsDirectory")
|
self.ResultsDirectory = node.getAttribute("ResultsDirectory")
|
||||||
self.hhBulkPath = node.getAttribute("hhBulkPath")
|
self.hhBulkPath = node.getAttribute("hhBulkPath")
|
||||||
self.saveActions = string_to_bool(node.getAttribute("saveActions"), default=False)
|
self.saveActions = string_to_bool(node.getAttribute("saveActions"), default=False)
|
||||||
|
@ -495,8 +494,8 @@ class Import:
|
||||||
self.saveStarsHH = string_to_bool(node.getAttribute("saveStarsHH"), default=False)
|
self.saveStarsHH = string_to_bool(node.getAttribute("saveStarsHH"), default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return " interval = %s\n callFpdbHud = %s\n hhArchiveBase = %s\n saveActions = %s\n fastStoreHudCache = %s\nResultsDirectory = %s" \
|
return " interval = %s\n callFpdbHud = %s\n saveActions = %s\n fastStoreHudCache = %s\nResultsDirectory = %s" \
|
||||||
% (self.interval, self.callFpdbHud, self.hhArchiveBase, self.saveActions, self.cacheSessions, self.sessionTimeout, self.fastStoreHudCache, self.ResultsDirectory)
|
% (self.interval, self.callFpdbHud, self.saveActions, self.cacheSessions, self.sessionTimeout, self.fastStoreHudCache, self.ResultsDirectory)
|
||||||
|
|
||||||
class HudUI:
|
class HudUI:
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
|
@ -861,9 +860,6 @@ class Config:
|
||||||
|
|
||||||
return nodes_added
|
return nodes_added
|
||||||
|
|
||||||
def set_hhArchiveBase(self, path):
|
|
||||||
self.imp.node.setAttribute("hhArchiveBase", path)
|
|
||||||
|
|
||||||
def find_default_conf(self):
|
def find_default_conf(self):
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
config_path = os.path.join(os.path.expanduser("~"), '.fpdb', 'default.conf')
|
config_path = os.path.join(os.path.expanduser("~"), '.fpdb', 'default.conf')
|
||||||
|
@ -1261,10 +1257,6 @@ class Config:
|
||||||
try: imp['interval'] = self.imp.interval
|
try: imp['interval'] = self.imp.interval
|
||||||
except: imp['interval'] = 10
|
except: imp['interval'] = 10
|
||||||
|
|
||||||
# hhArchiveBase is the temp store for part-processed hand histories - should be redundant eventually
|
|
||||||
try: imp['hhArchiveBase'] = self.imp.hhArchiveBase
|
|
||||||
except: imp['hhArchiveBase'] = "~/.fpdb/HandHistories/"
|
|
||||||
|
|
||||||
# ResultsDirectory is the local cache for downloaded results
|
# ResultsDirectory is the local cache for downloaded results
|
||||||
# NOTE: try: except: doesn'tseem to be triggering
|
# NOTE: try: except: doesn'tseem to be triggering
|
||||||
# using if instead
|
# using if instead
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
|
<FreePokerToolsConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FreePokerToolsConfig.xsd">
|
||||||
|
|
||||||
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" hhArchiveBase="~/.fpdb/HandHistories/" saveActions="True" cacheSessions="True" sessionTimeout="30"></import>
|
<import callFpdbHud = "True" interval = "10" fastStoreHudCache="False" saveActions="True" cacheSessions="True" sessionTimeout="30"></import>
|
||||||
|
|
||||||
<!-- These values determine what stats are displayed in the HUD
|
<!-- These values determine what stats are displayed in the HUD
|
||||||
|
|
||||||
|
|
|
@ -460,24 +460,8 @@ or None if we fail to get the info """
|
||||||
|
|
||||||
def sanityCheck(self):
|
def sanityCheck(self):
|
||||||
"""Check we aren't going to do some stupid things"""
|
"""Check we aren't going to do some stupid things"""
|
||||||
#TODO: the hhbase stuff needs to be in fpdb_import
|
|
||||||
sane = False
|
sane = False
|
||||||
base_w = False
|
base_w = False
|
||||||
#~ #Check if hhbase exists and is writable
|
|
||||||
#~ #Note: Will not try to create the base HH directory
|
|
||||||
#~ if not (os.access(self.hhbase, os.W_OK) and os.path.isdir(self.hhbase)):
|
|
||||||
#~ print "HH Sanity Check: Directory hhbase '" + self.hhbase + "' doesn't exist or is not writable"
|
|
||||||
#~ else:
|
|
||||||
#~ #Check if hhdir exists and is writable
|
|
||||||
#~ if not os.path.isdir(self.hhdir):
|
|
||||||
#~ # In first pass, dir may not exist. Attempt to create dir
|
|
||||||
#~ print "Creating directory: '%s'" % (self.hhdir)
|
|
||||||
#~ os.mkdir(self.hhdir)
|
|
||||||
#~ sane = True
|
|
||||||
#~ elif os.access(self.hhdir, os.W_OK):
|
|
||||||
#~ sane = True
|
|
||||||
#~ else:
|
|
||||||
#~ print "HH Sanity Check: Directory hhdir '" + self.hhdir + "' or its parent directory are not writable"
|
|
||||||
|
|
||||||
# Make sure input and output files are different or we'll overwrite the source file
|
# Make sure input and output files are different or we'll overwrite the source file
|
||||||
if True: # basically.. I don't know
|
if True: # basically.. I don't know
|
||||||
|
|
|
@ -1328,26 +1328,6 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def validate_config(self):
|
def validate_config(self):
|
||||||
# can this be removed now?
|
|
||||||
if self.config.get_import_parameters().get('saveStarsHH'):
|
|
||||||
hhbase = self.config.get_import_parameters().get("hhArchiveBase")
|
|
||||||
hhbase = os.path.expanduser(hhbase)
|
|
||||||
#hhdir = os.path.join(hhbase,site)
|
|
||||||
hhdir = hhbase
|
|
||||||
if not os.path.isdir(hhdir):
|
|
||||||
diapath = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Setup hh dir")
|
|
||||||
diastring = _("WARNING: Unable to find output hand history directory %s\n\n Press YES to create this directory, or NO to select a new one.") % hhdir
|
|
||||||
diapath.format_secondary_text(diastring)
|
|
||||||
response = diapath.run()
|
|
||||||
diapath.destroy()
|
|
||||||
if response == gtk.RESPONSE_YES:
|
|
||||||
try:
|
|
||||||
os.makedirs(hhdir)
|
|
||||||
except:
|
|
||||||
self.warning_box(_("WARNING: Unable to create hand output directory. Importing is not likely to work until this is fixed."))
|
|
||||||
elif response == gtk.RESPONSE_NO:
|
|
||||||
self.select_hhArchiveBase()
|
|
||||||
|
|
||||||
# check if sites in config file are in DB
|
# check if sites in config file are in DB
|
||||||
for site in self.config.get_supported_sites(True): # get site names from config file
|
for site in self.config.get_supported_sites(True): # get site names from config file
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -444,13 +444,6 @@ class Importer:
|
||||||
log.info((_("Converting %s") % file) + " (" + str(q.qsize()) + ")")
|
log.info((_("Converting %s") % file) + " (" + str(q.qsize()) + ")")
|
||||||
else:
|
else:
|
||||||
log.info(_("Converting %s") % file)
|
log.info(_("Converting %s") % file)
|
||||||
hhbase = self.config.get_import_parameters().get("hhArchiveBase")
|
|
||||||
hhbase = os.path.expanduser(hhbase)
|
|
||||||
hhdir = os.path.join(hhbase,site)
|
|
||||||
try:
|
|
||||||
out_path = os.path.join(hhdir, file.split(os.path.sep)[-2]+"-"+os.path.basename(file))
|
|
||||||
except:
|
|
||||||
out_path = os.path.join(hhdir, "x"+strftime("%d-%m-%y")+os.path.basename(file))
|
|
||||||
|
|
||||||
filter_name = filter.replace("ToFpdb", "")
|
filter_name = filter.replace("ToFpdb", "")
|
||||||
|
|
||||||
|
@ -462,9 +455,7 @@ class Importer:
|
||||||
idx = self.pos_in_file[file]
|
idx = self.pos_in_file[file]
|
||||||
else:
|
else:
|
||||||
self.pos_in_file[file] = 0
|
self.pos_in_file[file] = 0
|
||||||
hhc = obj( self.config, in_path = file, out_path = out_path, index = idx
|
hhc = obj( self.config, in_path = file, index = idx, starsArchive = self.settings['starsArchive'], ftpArchive = self.settings['ftpArchive'], sitename = site )
|
||||||
, starsArchive = self.settings['starsArchive'], ftpArchive = self.settings['ftpArchive'],
|
|
||||||
sitename = site )
|
|
||||||
if hhc.getStatus():
|
if hhc.getStatus():
|
||||||
handlist = hhc.getProcessedHands()
|
handlist = hhc.getProcessedHands()
|
||||||
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
self.pos_in_file[file] = hhc.getLastCharacterRead()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user