本文整理汇总了Python中soco.SoCo.previous方法的典型用法代码示例。如果您正苦于以下问题:Python SoCo.previous方法的具体用法?Python SoCo.previous怎么用?Python SoCo.previous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soco.SoCo
的用法示例。
在下文中一共展示了SoCo.previous方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sonos_previous
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [as 别名]
def sonos_previous(self):
"""Afspeellijst, <Previous> button, gaat naar vorige nummer, in de afspeellijst.
"""
# pagina laden voor als antwoord terug aan de server
h = queuebeheer_temp.sonos_previous()
##
sonos = SoCo(COORDINATOR)
sonos.previous()
return h
示例2: sonos
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [as 别名]
def sonos(command, volume=-1):
s = SoCo(app.config['SONOS'])
try:
if command == 'play':
s.play()
elif command == 'pause':
s.pause()
elif command =='volume':
logging.info('Setting volume of Sonos to %d' % volume)
s.volume(volume)
elif command == 'next':
s.next()
elif command == 'previous':
s.previous()
return "OK"
except:
return "FAIL"
示例3: SoCo
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [as 别名]
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:
print "Valid commands: play, pause, stop, next, previous, current, and partymode"
示例4: Song
# 需要导入模块: from soco import SoCo [as 别名]
# 或者: from soco.SoCo import previous [as 别名]
current_vol = sonos.volume
new_vol = current_vol - 5
if new_vol < 0:
new_vol = 0
sonos.ramp_to_volume(new_vol)
elif action == 'mute':
# Mute Volume
sonos.volume = 0
elif action == 'next':
# Next Song (might be unsupported by playback source e.g. streams)
try:
sonos.next()
except SoCoUPnPException:
print '[{"icon": "font-awesome:times-circle", "title": "Not supported for current playback source."}]'
elif action == 'prev':
# Previous Song (might be unsupported by playback source e.g. streams)
try:
sonos.previous()
except SoCoUPnPException:
print '[{"icon": "font-awesome:times-circle", "title": "Not supported for current playback source."}]'
elif action == 'set_zone':
# Used during setup to save preferred zone
settings_file_path = os.path.join(os.getenv('LB_SUPPORT_PATH'), 'settings.json')
settings = {'zone_ip_address': sonos_zone}
json.dump(settings, file(settings_file_path, 'w'))
webbrowser.open("x-launchbar:notification-center?string=Zone%20successfully%20set!&title=Sonos%20Controller")