Reverted audio algorithm

This commit is contained in:
Manuel Cortez 2015-05-13 08:55:45 -05:00
parent 0845553047
commit 4c125e4a7a
3 changed files with 4 additions and 48 deletions

View File

@ -12,7 +12,6 @@ use_invisible_keyboard_shorcuts = boolean(default=True)
play_ready_sound = boolean(default=True)
speak_ready_msg = boolean(default=True)
log_level = string(default="error")
use_modern_audio_algo = boolean(default=True)
[keymap]
up = string(default="control+win+up")

View File

@ -114,7 +114,6 @@ 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
@ -410,17 +409,3 @@ class Session(object):
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)
def clean_is_audio_memmos(self):
"Clean out memmos for is_audio"
for key,value in self.db.items():
if type(value) == list:
for i in value:
if 'is_audio' in i:
del i['is_audio']

View File

@ -43,29 +43,10 @@ def find_next_reply(id, listItem):
return None
def is_audio(tweet,force=False):
if force == False and 'is_audio' in tweet:
return tweet['is_audio']
try:
if len(find_urls(tweet)) < 1:
tweet['is_audio']=False
return False
if len(tweet["entities"]["hashtags"]) > 0:
for i in tweet["entities"]["hashtags"]:
if i["text"] == "audio":
tweet['is_audio']=True
return True
except:
log.exception("Exception while executing is_audio hashtag algorithm")
try:
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
if len(tweet["entities"]["hashtags"]) > 0:
for i in tweet["entities"]["hashtags"]:
if i["text"] == "audio":
return True
return False
def is_geocoded(tweet):
@ -131,12 +112,3 @@ def is_allowed(tweet, clients):
allowed = False
log.exception("Tuit not allowed: %s" % (tweet["text"],))
return allowed
def url_is_audio(u):
try:
response = requests.head(u,allow_redirects=True)
if 'audio' in str(response.headers['content-type']).lower():
return True
else:
return False
except:
log.exception("Exception while determining audio by HTTP headers")