當前位置: 首頁>>代碼示例>>Python>>正文


Python Radios.get_id方法代碼示例

本文整理匯總了Python中lollypop.radios.Radios.get_id方法的典型用法代碼示例。如果您正苦於以下問題:Python Radios.get_id方法的具體用法?Python Radios.get_id怎麽用?Python Radios.get_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lollypop.radios.Radios的用法示例。


在下文中一共展示了Radios.get_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: prepare_to_exit

# 需要導入模塊: from lollypop.radios import Radios [as 別名]
# 或者: from lollypop.radios.Radios import get_id [as 別名]
 def prepare_to_exit(self, action=None, param=None):
     """
         Save window position and view
     """
     if self._is_fs:
         return
     if self.settings.get_value('save-state'):
         self.window.save_view_state()
         # Save current track
         if self.player.current_track.id is None:
             track_id = -1
         elif self.player.current_track.id == Type.RADIOS:
             radios = Radios()
             track_id = radios.get_id(
                                     self.player.current_track.album_artist)
         else:
             track_id = self.player.current_track.id
         self.settings.set_value('track-id', GLib.Variant('i',
                                                          track_id))
         # Save current playlist
         if self.player.current_track.id == Type.RADIOS:
             playlist_ids = [Type.RADIOS]
         elif not self.player.get_user_playlist_ids():
             playlist_ids = []
         else:
             playlist_ids = self.player.get_user_playlist_ids()
         self.settings.set_value('playlist-ids', GLib.Variant('ai',
                                                              playlist_ids))
     self.player.stop_all()
     if self.window:
         self.window.stop_all()
     self.quit()
開發者ID:sgnls,項目名稱:lollypop,代碼行數:34,代碼來源:application.py

示例2: prepare_to_exit

# 需要導入模塊: from lollypop.radios import Radios [as 別名]
# 或者: from lollypop.radios.Radios import get_id [as 別名]
 def prepare_to_exit(self, action=None, param=None, exit=True):
     """
         Save window position and view
     """
     if self.__is_fs:
         return
     if self.settings.get_value('save-state'):
         self.window.save_view_state()
         # Save current track
         if self.player.current_track.id is None:
             track_id = -1
         elif self.player.current_track.id == Type.RADIOS:
             from lollypop.radios import Radios
             radios = Radios()
             track_id = radios.get_id(
                                 self.player.current_track.album_artists[0])
         else:
             track_id = self.player.current_track.id
             # Save albums context
             try:
                 dump(self.player.context.genre_ids,
                      open(DataPath + "/genre_ids.bin", "wb"))
                 dump(self.player.context.artist_ids,
                      open(DataPath + "/artist_ids.bin", "wb"))
                 self.player.shuffle_albums(False)
                 dump(self.player.get_albums(),
                      open(DataPath + "/albums.bin", "wb"))
             except Exception as e:
                 print("Application::prepare_to_exit()", e)
         dump(track_id, open(DataPath + "/track_id.bin", "wb"))
         dump([self.player.is_playing, self.player.is_party],
              open(DataPath + "/player.bin", "wb"))
         # Save current playlist
         if self.player.current_track.id == Type.RADIOS:
             playlist_ids = [Type.RADIOS]
         elif not self.player.get_user_playlist_ids():
             playlist_ids = []
         else:
             playlist_ids = self.player.get_user_playlist_ids()
         dump(playlist_ids,
              open(DataPath + "/playlist_ids.bin", "wb"))
     if self.player.current_track.id is not None:
         position = self.player.position
     else:
         position = 0
     dump(position, open(DataPath + "/position.bin", "wb"))
     self.player.stop_all()
     self.window.stop_all()
     if self.charts is not None:
         self.charts.stop()
     if exit:
         self.quit()
開發者ID:TainakaDrums,項目名稱:lollypop,代碼行數:54,代碼來源:application.py


注:本文中的lollypop.radios.Radios.get_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。