SoCo/socos — pull request #5 by stefankoegl (2014-03-11 20:58:00+00:00)
Title: Refactor socos to add an interactive shell

I've more or less completely refactored ``socos.py`` in order to add an interactive shell.

You can now do something like the following (comments added manually)

```` bash
# start interactive shell without parameters
$ python socos.py

# enter invalid command, and a list of valid ones will be dynamically created
socos> asdf
Unknown command "asdf"
Valid commands: play, set, stop, volume, previous, info, queue, pause, list, next, current, state, partymode, exit, unset

# no "all list" anymore
socos> list
192.168.0.135
192.168.0.129
192.168.0.132

# set a "current" speaker, all following commands will use it
socos> set 192.168.0.135
socos(192.168.0.135)> info
uid: XXXXXX
software_version: 12.9-12345
zone_icon: x-rincon-roomicon:xxxxx
mac_address: 00:11:22:33:44:55
hardware_version: 1.2.3.4-5
zone_name: ABC
serial_number: 00-11-22-33-44-55:6

# remove the current speaker
socos(192.168.0.135)> unset
socos> volume 192.168.0.135
19

socos> exit
````

The shell supports readline features such as arrow-navigation, Ctrl+R search, etc.

All other features should have been preserved. Error handling should still be improved, though. Tab-completion is also still missing.

Please let me know what you think.

-- Stefan