Added more parameters to audio search feature

This commit is contained in:
2019-01-26 17:44:50 -06:00
parent 0acdf41fa3
commit fb9717a00f
3 changed files with 25 additions and 1 deletions

View File

@@ -259,7 +259,11 @@ class Controller(object):
dlg = searchDialogs.searchAudioDialog()
if dlg.get_response() == widgetUtils.OK:
q = dlg.get("term")
newbuff = buffers.audioBuffer(parent=self.window.tb, name="{0}_audiosearch".format(q,), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q)
auto_complete = True
count = 300
performer_only = dlg.get_state("title")
sort = dlg.get_sort_order()
newbuff = buffers.audioBuffer(parent=self.window.tb, name="{0}_audiosearch".format(q,), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q, auto_complete=auto_complete, count=count, performer_only=performer_only, sort=sort)
self.buffers.append(newbuff)
call_threaded(newbuff.get_items)
# Translators: {0} will be replaced with the search term.

View File

@@ -16,6 +16,16 @@ class searchAudioDialog(widgetUtils.BaseDialog):
self.term.SetSize(dc.GetTextExtent("0"*40))
sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.term, 0, wx.ALL, 5)
radioSizer = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Search by"))
self.title = wx.RadioButton(radioSizer.GetStaticBox(), wx.NewId(), _("Title"), style=wx.RB_GROUP)
self.artist = wx.RadioButton(radioSizer.GetStaticBox(), wx.NewId(), _("Artist"))
radioSizer.Add(self.title, 0, wx.ALL, 5)
radioSizer.Add(self.artist, 0, wx.ALL, 5)
sizer.Add(radioSizer, 0, wx.ALL, 5)
sortBox = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Sort by"))
self.sortorder = wx.ComboBox(sortBox.GetStaticBox(), wx.NewId(), choices=[_("Date added"), _("Duration"), _("Popularity")], value=_("Popularity"), style=wx.CB_READONLY)
sortBox.Add(self.sortorder, 0, wx.ALL, 5)
sizer.Add(sortBox, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
@@ -26,6 +36,15 @@ class searchAudioDialog(widgetUtils.BaseDialog):
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def get_state(self, control):
if getattr(self, control).GetValue() == True:
return 1
else:
return 0
def get_sort_order(self):
return self.sortorder.GetSelection()
class searchVideoDialog(widgetUtils.BaseDialog):
def __init__(self, value=""):
super(searchVideoDialog, self).__init__(None, -1)