diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index 9e97c80..84ecc45 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -25,6 +25,8 @@ log = CPLog(__name__) class Plugin(object): + _class_name = None + enabled_option = 'enabled' auto_register_static = True @@ -51,10 +53,14 @@ class Plugin(object): self.registerStatic(inspect.getfile(self.__class__)) def conf(self, attr, value = None, default = None, section = None): - return Env.setting(attr, section = section if section else self.getName().lower(), value = value, default = default) + class_name = self.getName().lower().split(':') + return Env.setting(attr, section = section if section else class_name[0].lower(), value = value, default = default) def getName(self): - return self.__class__.__name__ + return self._class_name or self.__class__.__name__ + + def setName(self, name): + self._class_name = name def renderTemplate(self, parent_file, templ, **params): diff --git a/couchpotato/core/providers/base.py b/couchpotato/core/providers/base.py index 08b4c6e..f2db8da 100644 --- a/couchpotato/core/providers/base.py +++ b/couchpotato/core/providers/base.py @@ -13,10 +13,29 @@ import traceback import urllib2 import xml.etree.ElementTree as XMLTree - log = CPLog(__name__) +class MultiProvider(Plugin): + + def __init__(self): + self._classes = [] + + for Type in self.getTypes(): + klass = Type() + + # Overwrite name so logger knows what we're talking about + klass.setName('%s:%s' % (self.getName(), klass.getName())) + + self._classes.append(klass) + + def getTypes(self): + return [] + + def getClasses(self): + return self._classes + + class Provider(Plugin): type = None # movie, show, subtitle, trailer, ...