コード例 #1
0
 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
コード例 #2
0
ファイル: mpd.py プロジェクト: oleastre/lollypop
 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
コード例 #3
0
ファイル: mpd.py プロジェクト: goncalor/lollypop
 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
コード例 #4
0
ファイル: mpd.py プロジェクト: mozcelikors/ab2017-dpyo
 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