This commit is contained in:
Bill Dengler 2015-05-11 21:21:27 -04:00
parent 3f63046cbb
commit c1ce8cb8e5
4 changed files with 17 additions and 1 deletions

View File

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

View File

@ -428,6 +428,16 @@ class baseBufferController(bufferController):
@_tweets_exist @_tweets_exist
def url(self): def url(self):
"Select the best action for a URL."
tweet = self.get_tweet()
urls = utils.find_urls(tweet)
#handle audio-only (no weblinks) tweets.
if len(urls) == 1 and utils.is_audio(tweet) and self.session.settings["general"]["autohandle_audio"]:
return self.audio()
else:
return self.url_browser()
def url_browser(self):
tweet = self.get_tweet() tweet = self.get_tweet()
urls = utils.find_urls(tweet) urls = utils.find_urls(tweet)
if len(urls) == 1: if len(urls) == 1:

View File

@ -91,6 +91,7 @@ class accountSettingsController(globalSettingsController):
else: else:
self.dialog.set_value("general", "retweet_mode", _(u"Retweet with comments")) 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", "persist_size", str(self.config["general"]["persist_size"]))
self.dialog.set_value("general", "autohandle_audio", self.config["general"]["autohandle_audio"])
self.dialog.create_other_buffers() self.dialog.create_other_buffers()
buffer_values = self.get_buffers_list() buffer_values = self.get_buffers_list()
self.dialog.buffers.insert_buffers(buffer_values) self.dialog.buffers.insert_buffers(buffer_values)
@ -150,6 +151,8 @@ class accountSettingsController(globalSettingsController):
self.config["general"]["retweet_mode"] = "direct" self.config["general"]["retweet_mode"] = "direct"
else: else:
self.config["general"]["retweet_mode"] = "comment" self.config["general"]["retweet_mode"] = "comment"
if self.config["general"]["autohandle_audio"] != self.dialog.get_value("general", "autohandle_audio"):
self.config["general"]["autohandle_audio"] = self.dialog.get_value("general", "autohandle_audio")
buffers_list = self.dialog.buffers.get_list() buffers_list = self.dialog.buffers.get_list()
if set(self.config["general"]["buffer_order"]) != set(buffers_list): if set(self.config["general"]["buffer_order"]) != set(buffers_list):
self.needs_restart = True self.needs_restart = True

View File

@ -5,7 +5,7 @@ import logging as original_logger
import application import application
from multiplatform_widgets import widgets from multiplatform_widgets import widgets
import output import output
import config
class general(wx.Panel, baseDialog.BaseWXDialog): class general(wx.Panel, baseDialog.BaseWXDialog):
def __init__(self, parent, languages): def __init__(self, parent, languages):
super(general, self).__init__(parent) super(general, self).__init__(parent)
@ -94,8 +94,10 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(rMode, 0, wx.ALL, 5) 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)")) 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.persist_size = wx.TextCtrl(self, -1)
self.autohandle_audio= wx.CheckBox(self, -1, _(U"Automatically handle audio on "+config.app["keymap"]["url"]))
sizer.Add(PersistSizeLabel, 0, wx.ALL, 5) sizer.Add(PersistSizeLabel, 0, wx.ALL, 5)
sizer.Add(self.persist_size, 0, wx.ALL, 5) sizer.Add(self.persist_size, 0, wx.ALL, 5)
sizer.Add(self.autohandle_audio, 0, wx.ALL, 5)
self.SetSizer(sizer) self.SetSizer(sizer)
class other_buffers(wx.Panel): class other_buffers(wx.Panel):