本文整理匯總了Python中dejavu.Dejavu.log_event方法的典型用法代碼示例。如果您正苦於以下問題:Python Dejavu.log_event方法的具體用法?Python Dejavu.log_event怎麽用?Python Dejavu.log_event使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dejavu.Dejavu
的用法示例。
在下文中一共展示了Dejavu.log_event方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: blinkLed
# 需要導入模塊: from dejavu import Dejavu [as 別名]
# 或者: from dejavu.Dejavu import log_event [as 別名]
["ping", "-c", "3", hostname],
stderr=subprocess.STDOUT, # get all output
universal_newlines=True, # return string not bytes
)
except subprocess.CalledProcessError:
response = None
return response
try:
blinkLed(10)
if check_vpn() is not None:
config = getConguration()
djv = Dejavu(config)
djv.create_session(config["fingerprint"]["id"], config["vpn_ip"], config["remote_ip"])
djv.log_event("action", "boot")
atexit.register(exit_handler, djv)
if __name__ == "__main__":
a = datetime.now()
listen = 1
pause = 0.5
it = 1
try:
while True:
blinkLed(2)
song = djv.recognize(MicrophoneRecognizer, seconds=listen)
if song is not None:
djv.log_event("match", str(song["song_id"]))
print "Recognized %s\n" % (song)
blinkLed(5)
it += 1
示例2: check_vpn
# 需要導入模塊: from dejavu import Dejavu [as 別名]
# 或者: from dejavu.Dejavu import log_event [as 別名]
thread.daemon = True
try:
thread.start()
except KeyboardInterrupt:
server.shutdown()
sys.exit(0)
try:
if check_vpn() is not None:
print "vpn connection"
config = getConguration()
djv = Dejavu(config)
djv.create_session(config['fingerprint']['id'], config['vpn_ip'], config['remote_ip'])
print 'Session '+str(config['session'])
djv.log_event('action', 'boot')
atexit.register(exit_handler, djv)
print 'Start listening: http://'+str(config['vpn_ip'])+':'+str(PORT_NUMBER)+'/?on'
print 'Stop listening: http://'+str(config['vpn_ip'])+':'+str(PORT_NUMBER)+'/?off'
if __name__ == '__main__':
a = datetime.now()
listen = 1
pause = .5
it = 1
try:
while True:
if(shouldrun):
blinkLed(2)
song = djv.recognize(MicrophoneRecognizer, seconds=listen)
if song is not None:
djv.log_event('match', str(song['song_id']))