mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
#15: Allow for caching to be disabled, delete database when cache is disabled, remove unneeded conditional logic from method calls and move into methods themselves.
This commit is contained in:
parent
f394701789
commit
a5198b881e
@ -531,7 +531,6 @@ class Controller(object):
|
||||
if hasattr(session_.sessions[item], "timelinesStream"): session_.sessions[item].timelinesStream.disconnect()
|
||||
session_.sessions[item].sound.cleaner.cancel()
|
||||
log.debug("Shelving database for " + session_.sessions[item].session_id)
|
||||
if session_.sessions[item].settings["general"]["persistant_session"] == True:
|
||||
session_.sessions[item].shelve()
|
||||
|
||||
if system == "Windows":
|
||||
|
@ -113,7 +113,6 @@ class Session(object):
|
||||
log.debug("Creating config file %s" % (file_,))
|
||||
self.settings = config_utils.load_config(paths.config_path(file_), paths.app_path("Conf.defaults"))
|
||||
self.init_sound()
|
||||
if self.settings["general"]["persist_size"] != 0:
|
||||
self.deshelve()
|
||||
# except:
|
||||
# log.exception("The session configuration has failed.")
|
||||
@ -370,6 +369,10 @@ class Session(object):
|
||||
def shelve(self):
|
||||
"Shelve the database to allow for persistance."
|
||||
shelfname=paths.config_path(str(self.session_id)+".db")
|
||||
if self.settings["general"]["persist_size"] == 0:
|
||||
if os.path.exists(shelfname)
|
||||
os.remove(shelfname)
|
||||
return
|
||||
try:
|
||||
if not os.path.exists(shelfname):
|
||||
output.speak("Generating database, this might take a while.",True)
|
||||
@ -391,6 +394,10 @@ class Session(object):
|
||||
def deshelve(self):
|
||||
"Import a shelved database."
|
||||
shelfname=paths.config_path(str(self.session_id)+".db")
|
||||
if self.settings["general"]["persist_size"] == 0:
|
||||
if os.path.exists(shelfname)
|
||||
os.remove(shelfname)
|
||||
return
|
||||
try:
|
||||
shelf=shelve.open(paths.config_path(shelfname),'c')
|
||||
for key,value in shelf.items():
|
||||
|
Loading…
Reference in New Issue
Block a user