Removed some code

This commit is contained in:
Manuel Cortez 2015-06-08 05:41:48 -05:00
parent 83575b14b9
commit 0e3a4372b8
5 changed files with 4 additions and 33 deletions

View File

@ -12,9 +12,7 @@ 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_slow_audio_algo = boolean(default=False)
load_keymap = string(default="default.keymap") load_keymap = string(default="default.keymap")
use_Codeofdusk_audio_handlers=boolean(default=False)
[proxy] [proxy]
server = string(default="") server = string(default="")

View File

@ -30,12 +30,12 @@ class globalSettingsController(object):
for i in os.listdir(paths.app_path('keymaps')): for i in os.listdir(paths.app_path('keymaps')):
if ".keymap" not in i: if ".keymap" not in i:
continue continue
print paths.app_path('keymaps/'+i)
try: try:
res[config_utils.load_config(paths.app_path('keymaps/'+i))['info']['name']]=i res[config_utils.load_config(paths.app_path('keymaps/'+i))['info']['name']]=i
except: except:
log.exception("Exception while loading keymap " + i) log.exception("Exception while loading keymap " + i)
return res return res
def create_config(self): def create_config(self):
self.kmmap=self.make_kmmap() self.kmmap=self.make_kmmap()
self.langs = languageHandler.getAvailableLanguages() self.langs = languageHandler.getAvailableLanguages()
@ -60,8 +60,6 @@ class globalSettingsController(object):
self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"]) self.dialog.set_value("general", "use_invisible_shorcuts", config.app["app-settings"]["use_invisible_keyboard_shorcuts"])
self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"]) self.dialog.set_value("general", "disable_sapi5", config.app["app-settings"]["voice_enabled"])
self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"]) self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"])
self.dialog.set_value("general", "use_slow_audio_algo", config.app["app-settings"]["use_slow_audio_algo"])
self.dialog.set_value("general", "use_Codeofdusk_audio_handlers", config.app["app-settings"]["use_Codeofdusk_audio_handlers"])
self.dialog.create_proxy() self.dialog.create_proxy()
self.dialog.set_value("proxy", "server", config.app["proxy"]["server"]) self.dialog.set_value("proxy", "server", config.app["proxy"]["server"])
self.dialog.set_value("proxy", "port", config.app["proxy"]["port"]) self.dialog.set_value("proxy", "port", config.app["proxy"]["port"])
@ -87,11 +85,6 @@ class globalSettingsController(object):
config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit") config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit")
config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound") config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound")
config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg") config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg")
if config.app["app-settings"]["use_slow_audio_algo"] != self.dialog.get_value("general", "use_slow_audio_algo"):
config.app["app-settings"]["use_slow_audio_algo"] = self.dialog.get_value("general", "use_slow_audio_algo")
#Todo: clean memmos.
if config.app["app-settings"]["use_Codeofdusk_audio_handlers"] != self.dialog.get_value("general", "use_Codeofdusk_audio_handlers"):
config.app["app-settings"]["use_Codeofdusk_audio_handlers"] = self.dialog.get_value("general", "use_Codeofdusk_audio_handlers")
if config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"): if config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):
if self.is_started == True: if self.is_started == True:
self.needs_restart = True self.needs_restart = True

View File

@ -133,6 +133,7 @@ class URLStream(object):
self.stream.play() self.stream.play()
log.debug("played") log.debug("played")
call_threaded(self.delete_when_done) call_threaded(self.delete_when_done)
def is_playable(self, url,play=False,volume=1.0): def is_playable(self, url,play=False,volume=1.0):
try: try:
log.debug("Checking URL playability...") log.debug("Checking URL playability...")
@ -144,6 +145,7 @@ class URLStream(object):
return True return True
except: except:
return False return False
def delete_when_done(self): def delete_when_done(self):
while hasattr(self,'stream') and self.stream.is_playing: while hasattr(self,'stream') and self.stream.is_playing:
pass pass

View File

@ -44,31 +44,16 @@ def find_next_reply(id, listItem):
if listItem[i]["in_reply_to_status_id_str"] == str(id): return i if listItem[i]["in_reply_to_status_id_str"] == str(id): return i
return None return None
def is_audio(tweet,force=False): def is_audio(tweet):
if force == False and 'is_audio' in tweet:
return tweet['is_audio']
try: try:
if len(find_urls(tweet)) < 1: if len(find_urls(tweet)) < 1:
tweet['is_audio']=False
return False return False
if len(tweet["entities"]["hashtags"]) > 0: if len(tweet["entities"]["hashtags"]) > 0:
for i in tweet["entities"]["hashtags"]: for i in tweet["entities"]["hashtags"]:
if i["text"] == "audio": if i["text"] == "audio":
tweet['is_audio']=True
return True return True
except: except:
log.exception("Exception while executing is_audio hashtag algorithm") log.exception("Exception while executing is_audio hashtag algorithm")
try:
if config.app["app-settings"]["use_slow_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
def is_geocoded(tweet): def is_geocoded(tweet):
if tweet.has_key("coordinates") and tweet["coordinates"] != None: if tweet.has_key("coordinates") and tweet["coordinates"] != None:
@ -133,6 +118,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):
return sound.URLPlayer.is_playable(u)

View File

@ -36,10 +36,6 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
kmbox.Add(km_label, 0, wx.ALL, 5) kmbox.Add(km_label, 0, wx.ALL, 5)
kmbox.Add(self.km, 0, wx.ALL, 5) kmbox.Add(self.km, 0, wx.ALL, 5)
sizer.Add(kmbox, 0, wx.ALL, 5) sizer.Add(kmbox, 0, wx.ALL, 5)
self.use_slow_audio_algo= wx.CheckBox(self, -1, _(U"Use slow audio tweet detection algorithm (improves audio tweet detection accuracy at the cost of performance)"))
sizer.Add(self.use_slow_audio_algo, 0, wx.ALL, 5)
self.use_Codeofdusk_audio_handlers= wx.CheckBox(self, -1, _(U"Use Codeofdusk's tweet interaction handlers (intelegently handle audio tweets, may impact client performance on very slow connections)"))
sizer.Add(self.use_Codeofdusk_audio_handlers, 0, wx.ALL, 5)
self.SetSizer(sizer) self.SetSizer(sizer)
class proxy(wx.Panel, baseDialog.BaseWXDialog): class proxy(wx.Panel, baseDialog.BaseWXDialog):