Made algo option application-wide, setting should actually work now.

This commit is contained in:
Bill Dengler 2015-05-12 19:52:47 -04:00
parent ee1f95ea3b
commit ab08d21d95
5 changed files with 14 additions and 13 deletions

View File

@ -14,7 +14,6 @@ announce_stream_status = boolean(default=True)
retweet_mode = string(default="ask")
persist_size = integer(default=1764)
buffer_order = list(default=list('home','mentions','dm','sent_dm','sent_tweets','favorites','followers','friends','blocks','muted','events'))
use_modern_audio_algo = boolean(default=True)
[sound]
volume = float(default=1.0)

View File

@ -12,6 +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_modern_audio_algo = boolean(default=True)
[keymap]
up = string(default="control+win+up")

View File

@ -34,11 +34,13 @@ class globalSettingsController(object):
self.dialog.create_general(langs)
self.dialog.general.language.SetSelection(id)
self.dialog.set_value("general", "ask_at_exit", config.app["app-settings"]["ask_at_exit"])
self.dialog.set_value("general", "play_ready_sound", config.app["app-settings"]["play_ready_sound"])
self.dialog.set_value("general", "speak_ready_msg", config.app["app-settings"]["speak_ready_msg"])
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_modern_audio_algo", config.app["app-settings"]["use_modern_audio_algo"])
self.dialog.create_proxy()
self.dialog.set_value("proxy", "server", config.app["proxy"]["server"])
self.dialog.set_value("proxy", "port", config.app["proxy"]["port"])
@ -60,7 +62,10 @@ 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["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["app-settings"]["use_modern_audio_algo"] != self.dialog.get_value("general", "use_modern_audio_algo"):
config.app["app-settings"]["use_modern_audio_algo"] = self.dialog.get_value("general", "use_modern_audio_algo")
#Todo: clean memmos.
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
config.app["proxy"]["server"] = self.dialog.get_value("proxy", "server")
@ -92,7 +97,6 @@ class accountSettingsController(globalSettingsController):
else:
self.dialog.set_value("general", "retweet_mode", _(u"Retweet with comments"))
self.dialog.set_value("general", "persist_size", str(self.config["general"]["persist_size"]))
self.dialog.set_value("general", "use_modern_audio_algo", self.config["general"]["use_modern_audio_algo"])
self.dialog.create_other_buffers()
buffer_values = self.get_buffers_list()
self.dialog.buffers.insert_buffers(buffer_values)
@ -152,9 +156,6 @@ class accountSettingsController(globalSettingsController):
self.config["general"]["retweet_mode"] = "direct"
else:
self.config["general"]["retweet_mode"] = "comment"
if self.config["general"]["use_modern_audio_algo"] != self.dialog.get_value("general", "use_modern_audio_algo"):
self.config["general"]["use_modern_audio_algo"] = self.dialog.get_value("general", "use_modern_audio_algo")
self.buffer.session.clean_is_audio_memmos()
buffers_list = self.dialog.buffers.get_list()
if set(self.config["general"]["buffer_order"]) != set(buffers_list):
self.needs_restart = True

View File

@ -50,11 +50,11 @@ def is_audio(tweet,force=False):
if i["text"] == "audio":
tweet['is_audio']=True
return True
#implement conditional.
for u in find_urls(tweet):
if url_is_audio(u):
tweet['is_audio']=True
return True
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
tweet['is_audio']=False
return False

View File

@ -30,6 +30,8 @@ class general(wx.Panel, baseDialog.BaseWXDialog):
self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch"))
sizer.Add(self.hide_gui, 0, wx.ALL, 5)
self.SetSizer(sizer)
self.use_modern_audio_algo= wx.CheckBox(self, -1, _(U"Use audio tweet detection algorithm by Codeofdusk"))
sizer.Add(self.use_modern_audio_algo, 0, wx.ALL, 5)
class proxy(wx.Panel, baseDialog.BaseWXDialog):
@ -94,10 +96,8 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(rMode, 0, wx.ALL, 5)
PersistSizeLabel = wx.StaticText(self, -1, _(u"Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)"))
self.persist_size = wx.TextCtrl(self, -1)
self.use_modern_audio_algo= wx.CheckBox(self, -1, _(U"Use audio tweet detection algorithm by Codeofdusk"))
sizer.Add(PersistSizeLabel, 0, wx.ALL, 5)
sizer.Add(self.persist_size, 0, wx.ALL, 5)
sizer.Add(self.use_modern_audio_algo, 0, wx.ALL, 5)
self.SetSizer(sizer)
class other_buffers(wx.Panel):