diff --git a/examples/commandline/sonoshell.py b/examples/commandline/sonoshell.py index b2ed9ff..9776543 100644 --- a/examples/commandline/sonoshell.py +++ b/examples/commandline/sonoshell.py @@ -6,10 +6,10 @@ from soco import SonosDiscovery if __name__ == '__main__': - if (len(sys.argv) != 3): - print "Usage: sonoshell.py [speaker's IP|all] [cmd]" + if (len(sys.argv) < 3): + print "Usage: sonoshell.py [speaker's IP|all] [cmd] [option]" print "" - print "Valid commands (with IP): info, play, pause, stop, next, previous, current, and partymode" + print "Valid commands (with IP): info, play, pause, stop, next, previous, current, volume, and partymode" print "Valid commands (with 'all'): list_ips" sys.exit() @@ -43,6 +43,11 @@ 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.' + elif (cmd == 'volume'): + if (len(sys.argv) > 3): + print sonos.volume(int(sys.argv[3])) + else: + print sonos.volume() else: print "Valid commands (with IP): info, play, pause, stop, next, previous, current, and partymode"