本文整理汇总了Python中soco.SoCo.unjoin方法的典型用法代码示例。如果您正苦于以下问题:Python SoCo.unjoin方法的具体用法?Python SoCo.unjoin怎么用?Python SoCo.unjoin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soco.SoCo
的用法示例。
在下文中一共展示了SoCo.unjoin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: playTheme
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import unjoin [as 别名]
def playTheme(data, cur, themes, sonosPlayer):
if data['hw'] in themes.keys() and getLastAction(data, cur) == 'remove':
from soco import SoCo
sonos = SoCo(sonosPlayer)
if sonos.get_current_transport_info() == 'PLAYING':
return '';
sonos.unjoin();
sonos.play_uri(themes[data['hw']])
sonos.volume = 20;
if sonos.get_current_transport_info() == 'PLAYING':
return '';
sonos.play()
syslog.syslog('Playing theme for: ' + data['hw'])
示例2: playTheme
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import unjoin [as 别名]
def playTheme(themes, sonosPlayer):
sonos = SoCo(sonosPlayer)
#syslog.syslog('%s' % str(sonos.get_current_track_info()))
#return '';
if playerPlays(sonos):
syslog.syslog('Already playing')
return '';
sonos.unjoin()
sonos.clear_queue()
sonos.add_uri_to_queue(themes['closer'])
sonos.play_mode = 'REPEAT_ALL'
syslog.syslog('%s' % sonos.play_mode)
sonos.volume = 5;
if playerPlays(sonos):
return '';
sonos.play()
syslog.syslog('Playing Closer')
示例3: callback
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import unjoin [as 别名]
def callback(d):
data = json.loads(d)
url = data['url']
sonos_devices = SonosDiscovery()
ips = sonos_devices.get_speaker_ips()
master = SoCo(ips[0])
masteruid = master.get_speaker_info()['uid']
for ip in ips:
if not (ip == master.speaker_ip):
slave = SoCo(ip)
ret = slave.join(masteruid)
oldvol = master.volume
master.volume = 60
master.play_uri(url)
playing = True
while playing:
if master.get_current_transport_info()['current_transport_state'] == 'STOPPED':
playing = False
master.volume = oldvol
for ip in ips:
if not (ip == master.speaker_ip):
slave = SoCo(ip)
slave.unjoin()