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)
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="")

View File

@ -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

View File

@ -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

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
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)

View File

@ -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):