Exemplo n.º 1
0
 def updateResults(self):
     # Depending on heading, update page
     if self.heading == "播放清单/Playlists":
         self.results.addResults(DB.getPlaylists(self.searchBar.text()))
     elif self.heading == "最喜欢的歌曲/Favourite Songs":
         self.results.addResults(DB.getFavouriteSongs(
             self.searchBar.text()))
     elif self.heading == "最喜欢的歌手/Favourite Artists":
         self.results.addResults(
             DB.getFavouriteArtists(self.searchBar.text()))
     elif self.heading == "搜索语言/Language Search":
         self.results.addResults(DB.getLanguages(self.searchBar.text()))
     elif self.heading == "搜索歌手/Artist Search":
         if self.pastResults:
             self.results.addResults(
                 DB.getSongArtists(self.searchBar.text(),
                                   self.pastResults["language_id"]))
         else:
             self.results.addResults(
                 DB.getSongArtists(self.searchBar.text()))
     elif self.heading == "搜索全部/Search":
         if self.pastResults:
             if self.pastResults["type"] == "artists":
                 self.results.addResults(
                     DB.getSongTitles(self.searchBar.text(),
                                      artist=self.pastResults["artist_id"]))
             elif self.pastResults["type"] == "playlists":
                 self.results.addResults(
                     DB.getSongTitles(
                         self.searchBar.text(),
                         playlist=self.pastResults["playlist_id"]))
         else:
             self.results.addResults(DB.getSongTitles(
                 self.searchBar.text()))
Exemplo n.º 2
0
 def start(self):
     self.currentSong = random.choice(DB.getSongTitles(""))
     self.restartSong()