#33: Add is_audio rebuild method, to eliminate slowness as much as possible.

This commit is contained in:
Bill Dengler 2015-05-12 15:26:06 -04:00
parent ff9e16285e
commit 92cd16bec9

View File

@ -114,6 +114,7 @@ class Session(object):
self.settings = config_utils.load_config(paths.config_path(file_), paths.app_path("Conf.defaults")) self.settings = config_utils.load_config(paths.config_path(file_), paths.app_path("Conf.defaults"))
self.init_sound() self.init_sound()
self.deshelve() self.deshelve()
self.tag_audio_tweets()
# except: # except:
# log.exception("The session configuration has failed.") # log.exception("The session configuration has failed.")
# self.settings = None # self.settings = None
@ -408,3 +409,18 @@ class Session(object):
output.speak("An exception occurred while deshelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True) output.speak("An exception occurred while deshelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
log.exception("Exception while deshelving" + shelfname) log.exception("Exception while deshelving" + shelfname)
os.remove(shelfname) os.remove(shelfname)
def tag_audio_tweets(self):
"Checks for missing audio tags and repairs them to improve performance."
missings=[]
for key,value in self.db.items():
if type(value) == list:
for t in value:
if 'is_audio' not in t:
missings.append(t)
if len(missings) > 0:
output.speak(str(len(missings))+" tweets have missing audio tags. "+ application.name + " Will now repair all tags before starting. This may take a while.",True)
count=0
for m in missings:
utils.is_audio(m)
output.speak("Tagged " + str(count) + " of " + str(len(missings)))