当前位置: 首页>>代码示例>>Python>>正文


Python Track.get_popularity方法代码示例

本文整理汇总了Python中lollypop.objects.Track.get_popularity方法的典型用法代码示例。如果您正苦于以下问题:Python Track.get_popularity方法的具体用法?Python Track.get_popularity怎么用?Python Track.get_popularity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lollypop.objects.Track的用法示例。


在下文中一共展示了Track.get_popularity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _sticker

# 需要导入模块: from lollypop.objects import Track [as 别名]
# 或者: from lollypop.objects.Track import get_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 get_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.get_popularity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。