本文整理汇总了Python中soco.SoCo.partymode方法的典型用法代码示例。如果您正苦于以下问题:Python SoCo.partymode方法的具体用法?Python SoCo.partymode怎么用?Python SoCo.partymode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soco.SoCo
的用法示例。
在下文中一共展示了SoCo.partymode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SoCo
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import partymode [as 别名]
from soco import SoCo
if __name__ == '__main__':
if (len(sys.argv) != 3):
print "Usage: sonoshell.py [speaker's IP] [cmd]"
print ""
print "Valid commands: play, pause, stop, next, previous, current, and partymode"
sys.exit()
speaker_ip = sys.argv[1]
cmd = sys.argv[2].lower()
sonos = SoCo(speaker_ip)
if (cmd == 'partymode'):
print sonos.partymode()
elif (cmd == 'play'):
print sonos.play()
elif (cmd == 'pause'):
print sonos.pause()
elif (cmd == 'stop'):
print sonos.stop()
elif (cmd == 'next'):
print sonos.next()
elif (cmd == 'previous'):
print sonos.previous()
elif (cmd == 'current'):
track = sonos.get_current_track_info()
print 'Current track: ' + track['artist'] + ' - ' + track['title'] + '. From album ' + track['album'] + '. This is track number ' + track['playlist_position'] + ' in the playlist. It is ' + track['duration'] + ' minutes long.'
else: