Added exception handlers.

This commit is contained in:
Bill Dengler 2015-05-12 20:19:39 -04:00
parent c7d157145b
commit e67446b9bf

View File

@ -45,16 +45,22 @@ def find_next_reply(id, listItem):
def is_audio(tweet,force=False): def is_audio(tweet,force=False):
if force == False and 'is_audio' in tweet: if force == False and 'is_audio' in tweet:
return tweet['is_audio'] return tweet['is_audio']
if len(tweet["entities"]["hashtags"]) > 0: try:
for i in tweet["entities"]["hashtags"]: if len(tweet["entities"]["hashtags"]) > 0:
if i["text"] == "audio": for i in tweet["entities"]["hashtags"]:
tweet['is_audio']=True if i["text"] == "audio":
return True tweet['is_audio']=True
if config.app['app-settings']['use_modern_audio_algo']: return True
for u in find_urls(tweet): except:
if url_is_audio(u): log.exception("Exception while executing is_audio hashtag algorithm")
tweet['is_audio']=True try:
return True if config.app['app-settings']['use_modern_audio_algo']:
for u in find_urls(tweet):
if url_is_audio(u):
tweet['is_audio']=True
return True
except:
log.exception("Exception while executing is_audio Codeofdusk algorithm.")
tweet['is_audio']=False tweet['is_audio']=False
return False return False