本文整理汇总了Python中library.Library.hasVotes方法的典型用法代码示例。如果您正苦于以下问题:Python Library.hasVotes方法的具体用法?Python Library.hasVotes怎么用?Python Library.hasVotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类library.Library
的用法示例。
在下文中一共展示了Library.hasVotes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from library import Library [as 别名]
# 或者: from library.Library import hasVotes [as 别名]
class MainPlayer:
library = None
player = None
def __init__(self):
' Set the frequency of the player '
self.library = Library()
self.library.scan()
' Start the player '
self.player = FMPlayer()
def play(self):
' Check if there were any votes on the site... '
if self.library.hasVotes():
' Play the next top voted song... '
self.player.play(self.library.getTopVoted())
self.play()
else:
' ... else just play some random song... '
self.player.play(self.library.getRandomSong())
self.play()