From 0e3a4372b805b6abf7cc388a4aff39f0ecbfb8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Mon, 8 Jun 2015 05:41:48 -0500 Subject: [PATCH] Removed some code --- src/app-configuration.defaults | 2 -- src/controller/settings.py | 9 +-------- src/sound.py | 2 ++ src/twitter/utils.py | 20 +------------------- src/wxUI/dialogs/configuration.py | 4 ---- 5 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/app-configuration.defaults b/src/app-configuration.defaults index 36570a88..4939c87e 100644 --- a/src/app-configuration.defaults +++ b/src/app-configuration.defaults @@ -12,9 +12,7 @@ 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_slow_audio_algo = boolean(default=False) load_keymap = string(default="default.keymap") -use_Codeofdusk_audio_handlers=boolean(default=False) [proxy] server = string(default="") diff --git a/src/controller/settings.py b/src/controller/settings.py index bbe7425b..dfb61059 100644 --- a/src/controller/settings.py +++ b/src/controller/settings.py @@ -30,12 +30,12 @@ class globalSettingsController(object): for i in os.listdir(paths.app_path('keymaps')): if ".keymap" not in i: continue - print paths.app_path('keymaps/'+i) try: res[config_utils.load_config(paths.app_path('keymaps/'+i))['info']['name']]=i except: log.exception("Exception while loading keymap " + i) return res + def create_config(self): self.kmmap=self.make_kmmap() 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", "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", "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.set_value("proxy", "server", config.app["proxy"]["server"]) 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"]["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") - 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 self.is_started == True: self.needs_restart = True diff --git a/src/sound.py b/src/sound.py index 691a792e..95fcdfd0 100644 --- a/src/sound.py +++ b/src/sound.py @@ -133,6 +133,7 @@ class URLStream(object): self.stream.play() log.debug("played") call_threaded(self.delete_when_done) + def is_playable(self, url,play=False,volume=1.0): try: log.debug("Checking URL playability...") @@ -144,6 +145,7 @@ class URLStream(object): return True except: return False + def delete_when_done(self): while hasattr(self,'stream') and self.stream.is_playing: pass diff --git a/src/twitter/utils.py b/src/twitter/utils.py index 6c7eeaec..8bd7f2b7 100644 --- a/src/twitter/utils.py +++ b/src/twitter/utils.py @@ -44,31 +44,16 @@ 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,force=False): - if force == False and 'is_audio' in tweet: - return tweet['is_audio'] +def is_audio(tweet): 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_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): if tweet.has_key("coordinates") and tweet["coordinates"] != None: @@ -133,6 +118,3 @@ def is_allowed(tweet, clients): allowed = False log.exception("Tuit not allowed: %s" % (tweet["text"],)) return allowed - -def url_is_audio(u): - return sound.URLPlayer.is_playable(u) diff --git a/src/wxUI/dialogs/configuration.py b/src/wxUI/dialogs/configuration.py index b62c0807..085809e1 100644 --- a/src/wxUI/dialogs/configuration.py +++ b/src/wxUI/dialogs/configuration.py @@ -36,10 +36,6 @@ class general(wx.Panel, baseDialog.BaseWXDialog): kmbox.Add(km_label, 0, wx.ALL, 5) kmbox.Add(self.km, 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) class proxy(wx.Panel, baseDialog.BaseWXDialog):