mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Reverted audio algorithm
This commit is contained in:
parent
0845553047
commit
4c125e4a7a
@ -12,7 +12,6 @@ use_invisible_keyboard_shorcuts = boolean(default=True)
|
|||||||
play_ready_sound = boolean(default=True)
|
play_ready_sound = boolean(default=True)
|
||||||
speak_ready_msg = boolean(default=True)
|
speak_ready_msg = boolean(default=True)
|
||||||
log_level = string(default="error")
|
log_level = string(default="error")
|
||||||
use_modern_audio_algo = boolean(default=True)
|
|
||||||
|
|
||||||
[keymap]
|
[keymap]
|
||||||
up = string(default="control+win+up")
|
up = string(default="control+win+up")
|
||||||
|
@ -114,7 +114,6 @@ 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.fix_audio_tags()
|
|
||||||
# except:
|
# except:
|
||||||
# log.exception("The session configuration has failed.")
|
# log.exception("The session configuration has failed.")
|
||||||
# self.settings = None
|
# self.settings = None
|
||||||
@ -410,17 +409,3 @@ class Session(object):
|
|||||||
log.exception("Exception while deshelving" + shelfname)
|
log.exception("Exception while deshelving" + shelfname)
|
||||||
os.remove(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']
|
|
@ -43,29 +43,10 @@ def find_next_reply(id, listItem):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def is_audio(tweet,force=False):
|
def is_audio(tweet,force=False):
|
||||||
if force == False and 'is_audio' in tweet:
|
if len(tweet["entities"]["hashtags"]) > 0:
|
||||||
return tweet['is_audio']
|
for i in tweet["entities"]["hashtags"]:
|
||||||
try:
|
if i["text"] == "audio":
|
||||||
if len(find_urls(tweet)) < 1:
|
return True
|
||||||
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
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_geocoded(tweet):
|
def is_geocoded(tweet):
|
||||||
@ -131,12 +112,3 @@ def is_allowed(tweet, clients):
|
|||||||
allowed = False
|
allowed = False
|
||||||
log.exception("Tuit not allowed: %s" % (tweet["text"],))
|
log.exception("Tuit not allowed: %s" % (tweet["text"],))
|
||||||
return allowed
|
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")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user