Added more hooks, we now call the proper method to cache audio test results, added force flag to skip memmo checks and overwrite invalid memmos (useful when switching algos).

This commit is contained in:
Bill Dengler 2015-05-12 19:11:24 -04:00
parent 9b4fdc8966
commit 8ce5c258d3
3 changed files with 11 additions and 3 deletions

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.init_sound()
self.deshelve()
self.fix_audio_tags()
# except:
# log.exception("The session configuration has failed.")
# self.settings = None
@ -408,3 +409,10 @@ 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)
log.exception("Exception while deshelving" + shelfname)
os.remove(shelfname)
def fix_audio_tags(self,force=False):
"Repair audio tags."
for key,value in self.db.items():
if type(value) == list:
for t in value:
utils.is_audio(t,force=force)

View File

@ -37,7 +37,7 @@ class streamer(TwythonStreamer):
self.session.db[place].append(data)
else:
self.session.db[place].insert(0, data)
utils.is_audio(data)
def block_user(self, data):
id = data["target"]["id"]
if id in self.friends:

View File

@ -42,8 +42,8 @@ def find_next_reply(id, listItem):
if listItem[i]["in_reply_to_status_id_str"] == str(id): return i
return None
def is_audio(tweet):
if 'is_audio' in tweet:
def is_audio(tweet,force=False):
if force == False and 'is_audio' in tweet:
return tweet['is_audio']
if len(tweet["entities"]["hashtags"]) > 0:
for i in tweet["entities"]["hashtags"]: