> 
> Hi Elisa-Gurus
> Is it possible to have the same plugin installed under both music/internet 
> and video/internet but not duplicating the code?
> The code pretty much the same same but some conf-files might be different, 
> and single methods might depend on whether or not it is video or music

Of course. The way you add an entry in music->internet or
video->internet is through what we call a decorator, that you declare in
the setup.py of your plugin. A decorator is a function that is called
whenever a controller at a given controller path (for a given "menu") is
created. You could easily declare in your plugin a decorator for
music->internet and another one for video->internet (or possibly the
same decorator for both). See for instance the youtube plugin for an
example of decorator.
After that, avoiding code duplication is a software design issue that is
clearly not specific to Elisa. Depending on what you want to do, you
could create a class implementing your controllers that would be used in
both cases, but with different initialisation parameters, or you could
have one class for each section, both inheriting from a common base
class implementing the stuff that makes sense for both.

Guillaume


On 00:50 Sat 14 Feb     , Kristian Lippert wrote:
> 
> Best Regards,
> Kristian
> 
> 
> _________________________________________________________________
> More than messages–check out the rest of the Windows Live™.
> http://www.microsoft.com/windows/windowslive/

Reply via email to