Exemplo n.º 1
0
	def run(self):
		if self.artist == None:
			wx.PostEvent(self.frame, evtExecFunc(func=EnableFrame, attr1=False))
			wx.PostEvent(self.frame, evtExecFunc(func=SetStatus, attr1='Searching for \"' + self.query + '\"...'))
			self.frame.results = groove.getSearchResultsEx(self.query, "Artists")
			if self.frame.results != []:
				for a in self.frame.results:
					b = Artist()
					b.name = a["ArtistName"]
					b.isVer = a["IsVerified"]
					b.id = a["ArtistID"]
					self.frame.artists.append(b)
				def f(frame, event): frame.lst_artists.SetObjects(frame.artists)
				wx.PostEvent(self.frame, evtExecFunc(func=f))
			wx.PostEvent(self.frame, evtExecFunc(func=SetStatus, attr1="Ready"))
			wx.PostEvent(self.frame, evtExecFunc(func=EnableFrame, attr1=True))
			wx.PostEvent(self.frame, evtExecFunc(func=SetFocus, attr1=self.frame.lst_artists))
			if self.frame.results == []:
				def f(frame, event): 
					frame.lst_artists.SetEmptyListMsg("No")
					frame.lst_albums.SetEmptyListMsg("results")
					frame.lst_songs.SetEmptyListMsg("found.")
				def f2(frame, event): 
					frame.lst_artists.SetEmptyListMsg("N/A")
					frame.lst_albums.SetEmptyListMsg("N/A")
					frame.lst_songs.SetEmptyListMsg("N/A")
				wx.PostEvent(self.frame, evtExecFunc(func=f))
				time.sleep(1)
				wx.PostEvent(self.frame, evtExecFunc(func=f2))
		else:
			if not self.artist.gotalbums:
				wx.PostEvent(self.frame, evtExecFunc(func=EnableFrame, attr1=False))
				wx.PostEvent(self.frame, evtExecFunc(func=SetStatus, attr1='Retreiving artist\'s songs...'))
				self.frame.results = groove.artistGetSongsEx(self.artist.id, self.artist.isVer)
				for i in self.frame.results['result']:
					flag = True
					for a in self.artist.Albums:
						if a.id == i["AlbumID"]:
							flag = False
							break
					if flag:
						a = Album()
						a.name = i["AlbumName"]
						a.id = i["AlbumID"]
						self.artist.Albums.append(a)
				for i in self.frame.results['result']:
					for a in self.artist.Albums:
						if a.id == i["AlbumID"]:
							a.Songs.append(i)
							break
				self.artist.gotalbums = True
			def f(frame, event): frame.lst_albums.SetObjects(self.artist.Albums)
			wx.PostEvent(self.frame, evtExecFunc(func=f))
			wx.PostEvent(self.frame, evtExecFunc(func=SetStatus, attr1="Ready"))
			wx.PostEvent(self.frame, evtExecFunc(func=EnableFrame, attr1=True))
Exemplo n.º 2
0
	def run(self):
		wx.PostEvent(self.frame, evtExecFunc(func=EnableFrame, attr1=False))
		wx.PostEvent(self.frame, evtExecFunc(func=SetStatus, attr1='Searching for \"' + self.query + '\"...'))
		self.frame.results = groove.getSearchResultsEx(self.query, "Songs")
		if self.frame.results != []:
			def f(frame, event): frame.lst_results.SetObjects(frame.results)
			wx.PostEvent(self.frame, evtExecFunc(func=f))
			wx.PostEvent(self.frame, evtExecFunc(func=f))
		wx.PostEvent(self.frame, evtExecFunc(func=SetStatus, attr1="Ready"))
		wx.PostEvent(self.frame, evtExecFunc(func=EnableFrame, attr1=True))
		wx.PostEvent(self.frame, evtExecFunc(func=SetFocus, attr1=self.frame.lst_results))
		if self.frame.results == []:
			def f(frame, event): frame.lst_results.DeleteAllItems()
			wx.PostEvent(self.frame, evtExecFunc(func=f))
			def f1(frame, event): frame.lst_results.SetEmptyListMsg("No results found.")
			def f2(frame, event): frame.lst_results.SetEmptyListMsg(emptylistmsg)
			wx.PostEvent(self.frame, evtExecFunc(func=f1))
			time.sleep(1)
			wx.PostEvent(self.frame, evtExecFunc(func=f2))