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


Python Track.set_popularity方法代碼示例

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


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

示例1: _sticker

# 需要導入模塊: from lollypop.objects import Track [as 別名]
# 或者: from lollypop.objects.Track import set_popularity [as 別名]
 def _sticker(self, cmd_args):
     """
         Send stickers
         @syntax sticker [get|set] song rating
         @param args as str
         @return msg as str
     """
     args = self._get_args(cmd_args)
     msg = ""
     if args[0].find("get song ") != -1 and\
             args[2].find("rating") != -1:
         track_id = Lp().tracks.get_id_by_path(args[1])
         track = Track(track_id)
         msg = "sticker: rating=%s\n" % int(track.get_popularity()*2)
     elif args[0].find("set song") != -1 and\
             args[2].find("rating") != -1:
         track_id = Lp().tracks.get_id_by_path(args[1])
         track = Track(track_id)
         track.set_popularity(int(args[3])/2)
     return msg
開發者ID:oleastre,項目名稱:lollypop,代碼行數:22,代碼來源:mpd.py

示例2: _sticker

# 需要導入模塊: from lollypop.objects import Track [as 別名]
# 或者: from lollypop.objects.Track import set_popularity [as 別名]
 def _sticker(self, cmd_args):
     """
         Send stickers
         @syntax sticker [get|set] song rating
         @param args as str
         @return msg as str
     """
     args = self._get_args(cmd_args)
     msg = ""
     print(args)
     if args[0] == "get" and args[1] == "song" and\
             args[3] == "rating":
         track_id = Lp().tracks.get_id_by_path(args[2])
         track = Track(track_id)
         msg = "sticker: rating=%s\n" % int((track.get_popularity()-0.5)*2)
     elif args[0] == "set" and args[1] == "song" and\
             args[3] == "rating":
         track_id = Lp().tracks.get_id_by_path(args[2])
         track = Track(track_id)
         track.set_popularity(int(args[4])/2)
     return msg
開發者ID:goncalor,項目名稱:lollypop,代碼行數:23,代碼來源:mpd.py


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