SoCo/SoCo — pull request #140 by KennethNielsen (2014-05-22 20:51:55+00:00)
Title: Wimp part 2 (browse method), better generalized music service data structures

I must learn to break this down into smaller chunks as it always seem like a marathon when I have to send stuff in. Anyway, here it is, part 2 of the wimp plugin, which now allows you to browse the music as presented in the app and the data structures has now been generalized so much that I believe they can be used for other services as well.

As far as wimp goes I have added a `browse` command. Called with no arguments, it will return the elements in the root of the music tree i.g:

```python
import soco
soc = soco.SoCo('192.168.0.12')
wimp = Wimp(soc, 'wimpusername')
root = wimp.browse()
print root
{u'count': '15', u'item_list': [, , , , , , , , , , , , , , ], u'total': '15', u'index': '0'}
```

called with one of the ms items from this result as the argument, it will show the underelements of that i.e:

```python
wimp.browse(root['item_list'][6])
{u'count': '20', u'item_list': [, , , , , , , , , , , , , , , , , , , ], u'total': '20', u'index': '0'}
```

I anyone wants to test this new functionality you can download [this file](https://github.com/KennethNielsen/SoCo/blob/wimp_part2_tests/soco/plugins/test_random.py). When run, it will take a random walk down the music tree and choose one of the playable items at random to put in the queue and then let you listen to 15 s of the first track from that and then do it all again. It is a nice way to randomly test the reliability of the code.

There are still some problems with this. In some cases (rarely) you might get a UPnP 800 error, but I have not yet figured what triggers. I am unable to reproduce it by excising the same MS items, so I will have to do some more digging. But the code is quite stable, so it should definitely be doable.

Next is docs, tests and writing docs about how to implement a plugin that uses the ms data structures.

Let me know what you think.