Guest User

Untitled

a guest
Apr 26th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. def set_rating(self, rating):
  2. """
  3. Sets the current track rating from an integer, on the
  4. scale determined by the ``miscellaneous/rating_steps`` setting.
  5.  
  6. :raises: ValueError on invalid rating
  7. """
  8. rating = float(rating)
  9. steps = float(settings.get_option("miscellaneous/rating_steps", 5))
  10. rating = min(rating, steps)
  11. rating = max(0, rating)
  12. rating = float(rating * 100.0 / steps)
  13. self.set_tag_raw('__rating', rating)
Add Comment
Please, Sign In to add comment