Added all options available in the API for audio searches
This commit is contained in:
		@@ -144,10 +144,11 @@ class Controller(object):
 | 
			
		||||
		if dlg.get_response() == widgetUtils.OK:
 | 
			
		||||
			q = dlg.get("term").encode("utf-8")
 | 
			
		||||
			count = 300
 | 
			
		||||
			auto_complete = 1
 | 
			
		||||
			lyrics = 0
 | 
			
		||||
			performer_only = 0
 | 
			
		||||
			newbuff = buffers.audioBuffer(parent=self.window.tb, name=u"{0}_audiosearch".format(q.decode("utf-8"),), session=self.session, composefunc="compose_audio", parent_endpoint="audio", endpoint="search", q=q, count=count, auto_complete=auto_complete, lyrics=lyrics, performer_only=performer_only)
 | 
			
		||||
			auto_complete = dlg.get_checkable("auto_complete")
 | 
			
		||||
			lyrics = dlg.get_checkable("lyrics")
 | 
			
		||||
			performer_only = dlg.get_checkable("artist_only")
 | 
			
		||||
			sort = dlg.get_sort_order()
 | 
			
		||||
			newbuff = buffers.audioBuffer(parent=self.window.tb, name=u"{0}_audiosearch".format(q.decode("utf-8"),), session=self.session, composefunc="compose_audio", parent_endpoint="audio", endpoint="search", q=q, count=count, auto_complete=auto_complete, lyrics=lyrics, performer_only=performer_only, sort=sort)
 | 
			
		||||
			self.buffers.append(newbuff)
 | 
			
		||||
			call_threaded(newbuff.get_items)
 | 
			
		||||
			self.window.insert_buffer(newbuff.tab, _(u"Search for {0}").format(q.decode("utf-8"),), self.window.search("audios"))
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,23 @@ 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)
 | 
			
		||||
		self.auto_complete = wx.CheckBox(panel, wx.NewId(), _(u"Try to &correct for mistakes in the search term"))
 | 
			
		||||
		self.auto_complete.SetValue(True)
 | 
			
		||||
		sizer.Add(self.auto_complete, 0, wx.ALL, 5)
 | 
			
		||||
		self.lyrics = wx.CheckBox(panel, wx.NewId(), _(u"Search only songs with associated &lyrics"))
 | 
			
		||||
		sizer.Add(self.lyrics, 0, wx.ALL, 5)
 | 
			
		||||
		self.artist_only  = wx.RadioButton(panel, wx.NewId(), _(u"Search all songs with this title"), style=wx.RB_GROUP)
 | 
			
		||||
		self.audios = wx.RadioButton(panel, wx.NewId(), _(u"Search audios of this artist"))
 | 
			
		||||
		radioSizer = wx.BoxSizer(wx.HORIZONTAL)
 | 
			
		||||
		radioSizer.Add(self.artist_only, 0, wx.ALL, 5)
 | 
			
		||||
		radioSizer.Add(self.audios, 0, wx.ALL, 5)
 | 
			
		||||
		sizer.Add(radioSizer, 0, wx.ALL, 5)
 | 
			
		||||
		sort_order = wx.StaticText(panel, -1, _(U"&Sort order by: "))
 | 
			
		||||
		self.sortorder  = wx.ComboBox(panel, wx.NewId(), choices=[_(u"Date added"), _(u"Duration"), _(u"Popularity")], value=_(u"Popularity"), style=wx.CB_READONLY)
 | 
			
		||||
		rBox = wx.BoxSizer(wx.HORIZONTAL)
 | 
			
		||||
		rBox.Add(sort_order, 0, wx.ALL, 5)
 | 
			
		||||
		rBox.Add(self.sortorder, 0, wx.ALL, 5)
 | 
			
		||||
		sizer.Add(rBox, 0, wx.ALL, 5)
 | 
			
		||||
		ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
 | 
			
		||||
		ok.SetDefault()
 | 
			
		||||
		cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
 | 
			
		||||
@@ -24,3 +41,12 @@ class searchAudioDialog(widgetUtils.BaseDialog):
 | 
			
		||||
		sizer.Add(btnsizer, 0, wx.ALL, 5)
 | 
			
		||||
		panel.SetSizer(sizer)
 | 
			
		||||
		self.SetClientSize(sizer.CalcMin())
 | 
			
		||||
 | 
			
		||||
	def get_checkable(self, control):
 | 
			
		||||
		if getattr(self, control).GetValue() == True:
 | 
			
		||||
			return 1
 | 
			
		||||
		else:
 | 
			
		||||
			return 0
 | 
			
		||||
 | 
			
		||||
	def get_sort_order(self):
 | 
			
		||||
		return self.sortorder.GetSelection()
 | 
			
		||||
		Reference in New Issue
	
	Block a user