本文整理汇总了Python中Scheduler.Scheduler.setLocalQuota方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.setLocalQuota方法的具体用法?Python Scheduler.setLocalQuota怎么用?Python Scheduler.setLocalQuota使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.setLocalQuota方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import setLocalQuota [as 别名]
class Ghoul:
def __init__(self):
configStream = file('config.yaml', 'r')
config = yaml.load(configStream)
self.libraryDB = psycopg2.connect(host = config['music_database']['host'],
user = config['music_database']['user'],
password = config['music_database']['password'],
database = config['music_database']['database'])
try:
self.messageDB = psycopg2.connect(host = config['msg_database']['host'],
user = config['msg_database']['user'],
password = config['msg_database']['password'],
database = config['msg_database']['database'])
self.messages = MessageLibrary(self.messageDB)
self.messages.setStingCategories(config['messages']['sting_categories'])
PlayItem.Message.basePath = config['file_manager']['message_base_path']
except TypeError:
self.messages = None
if config['file_manager']['mode'] == "external":
self.fm = ExternalFileManager(config['file_manager']['user_id'],
config['file_manager']['password'],
config['file_manager']['httpUser'],
config['file_manager']['httpPass'])
elif config['file_manager']['mode'] == 'local':
self.fm = LocalFileManager(config['file_manager']['music_base_path'])
self.library = MusicLibrary(self.libraryDB)
self.library.setAustralianNames(config['music']['aus_names'])
self.library.setMaxSongLength(config['music']['max_song_length'])
PlayItem.Song.ausNames = config['music']['aus_names']
self.logger = PlaylistLogger(config['logger']['auth'], config['logger']['baseURL'],config['logger']['showID'])
self.playQueue = Queue(5)
self.scheduler = Scheduler(self.library, self.messages, self.fm, self.playQueue)
self.scheduler.setDemoQuota(config['scheduler']['quotas']['demo'])
self.scheduler.setLocalQuota(config['scheduler']['quotas']['local'])
self.scheduler.setAusQuota(config['scheduler']['quotas']['aus'])
self.scheduler.setFemaleQuota(config['scheduler']['quotas']['female'])
self.scheduler.setConsecutiveSongs(config['scheduler']['consecutive_songs']['min'],
config['scheduler']['consecutive_songs']['max'])
self.scheduler.addListener(self)
self.player = Player.Player()
self.playThread = Player.PlayThread(self.player, self.playQueue)
self.playThread.addListener(self)
self.paused = False
self.listeners = list()
def addListener(self, listener):
self.listeners.append(listener)
def play(self):
if self.paused:
self.paused = False
self.player.togglePause()
else:
self.logger.startNewPlaylist()
self.scheduler.start()
self.playThread.start()
def pause(self):
self.paused = True
self.player.togglePause()
def getElapsedTime(self):
return self.player.getElapsedTime()
def getQueuedItems(self):
items = list()
for elem in list(self.playQueue.queue):
items.append(elem)
return items
def itemPlaying(self, item):
if isinstance(item, PlayItem.Song):
self.logger.submitSong(item)
for l in self.listeners:
l.itemPlaying(item)
def itemQueued(self, item):
for l in self.listeners:
l.itemQueued(item)