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.getResultsFromSearch(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))
def main(): parser = argparse.ArgumentParser(description = 'Export Spotify playlist to MP3.') parser.add_argument('-f', '--filename', help='File holding list of HTTP spotify URIs.', required = True) args = vars(parser.parse_args()) groove.getToken() with open( args['filename'], 'rb') as input: for line in input: print "~"*80 sp_track = spotify.Track(line) cout.header(str(sp_track)) if sp_track.getFileExists("."): cout.warning("File alredy exits") continue gs_tracks = compare.get_groove_tracks(groove.getResultsFromSearch(sp_track.getName())) match_score, match_track = sp_track.get_bets_match(gs_tracks) if not match_track: cout.warning("No match") continue groove.downloadSong(match_track.meta, sp_track.getFileName(), groove.chunk_report)
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.getResultsFromSearch(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))
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.getResultsFromSearch(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))