Extension framework

I have made a simple framework for plugins, that will allow us to put all that code that is specific to just a single music service (including its xml requests) each into its own plugin, so that we don't clutter up the main class to much and make it too big.

You essentially create a plugin by creating a file inside the plugins dir that contains as its primary class one that is named in the same way is the file only in CamelCase, e.g. class Wimp() inside wimp.py. this class should take an instance of soco as its fist argument and a dictionary of additional arguments as is second, and that's it. Then the plugin can be loaded as soco.set_plugin('Wimp').

The following code illustrates how the plugins can be used:

    import soco
    import time
    
    g = soco.SoCo('192.168.0.110')
    plugin = g.get_plugin()
    print 'Before we load a pluing it just returns us {0}'.format(plugin)
    g.set_plugin('ExamplePlugin', {'user_name': 'Scooby Doo'})
    plugin = g.get_plugin()
    print 'Afterwards it returns us a reference to the plugin instance {0}'\
        .format(plugin)
    # We can acces it through the variable it is stored in in SoCo
    print 'Acessing though SoCo'
    g.plugin.music_plugin_stop()
    time.sleep(1)
    g.plugin.music_plugin_play()
    time.sleep(5)
    
    # You can also get the music plugin and access its functions directly
    print 'Accessing it directly'
    plugin = g.get_plugin()
    plugin.music_plugin_stop()
    time.sleep(1)
    plugin.music_plugin_play()

Let me know what you guys think. If this is usable I will of course write documentation on how to implement a plugin.