diff options
| author | 2015-04-18 16:48:48 +0200 | |
|---|---|---|
| committer | 2015-04-18 16:48:48 +0200 | |
| commit | ca08ffb14c17565fa85709e4fbb3c0747a74843e (patch) | |
| tree | e7c9d5b459086c221e771ac3170974666f0345de /pyload | |
| parent | Spare code cosmetics (5) (diff) | |
| parent | fixed: MultiHook (diff) | |
| download | pyload-ca08ffb14c17565fa85709e4fbb3c0747a74843e.tar.xz | |
Merge pull request #7 from ardi69/0.4.10
fix SyntaxError
Diffstat (limited to 'pyload')
| -rwxr-xr-x | pyload/Core.py | 8 | ||||
| -rw-r--r-- | pyload/api/__init__.py | 16 | ||||
| -rw-r--r-- | pyload/manager/Plugin.py | 8 | ||||
| -rw-r--r-- | pyload/plugin/internal/MultiHook.py | 64 | ||||
| -rw-r--r-- | pyload/webui/app/pyloadweb.py | 2 | 
5 files changed, 50 insertions, 48 deletions
| diff --git a/pyload/Core.py b/pyload/Core.py index e6f6fefcb..f723d8366 100755 --- a/pyload/Core.py +++ b/pyload/Core.py @@ -518,7 +518,7 @@ class Core(object):                      'CRITICAL': "purple"                  } -            console_frm = colorlog.ColoredFormatter(format=c_fmt, +            console_frm = colorlog.ColoredFormatter(fmt=c_fmt,                                                      datefmt=date_fmt,                                                      log_colors=clr,                                                      secondary_log_colors=extra_clr) @@ -596,7 +596,7 @@ class Core(object):              if not file_exists and not quiet:                  if file_created: -                #self.log.info( _("%s created") % description ) +                    #self.log.info( _("%s created") % description )                      pass                  else:                      if not empty: @@ -674,7 +674,7 @@ def deamon():      try:          pid = os.fork()          if pid > 0: -        # exit from second parent, print eventual PID before +            # exit from second parent, print eventual PID before              print "Daemon PID %d" % pid              sys.exit(0)      except OSError, e: @@ -698,7 +698,7 @@ def deamon():  def main():      if "--daemon" in sys.argv: -            deamon() +        deamon()      else:          pyload_core = Core()          try: diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py index 62af70cf8..b5c1dfbf4 100644 --- a/pyload/api/__init__.py +++ b/pyload/api/__init__.py @@ -120,23 +120,23 @@ class Api(Iface):      @permission(PERMS.SETTINGS) -    def getConfigValue(self, section, option, section="core"): +    def getConfigValue(self, category, option, section="core"):          """Retrieve config value. -        :param section: name of section, or plugin +        :param category: name of category, or plugin          :param option: config option          :param section: 'plugin' or 'core'          :return: config value as string          """          if section == "core": -            value = self.core.config.get(section, option) +            value = self.core.config[category][option]          else: -            value = self.core.config.getPlugin(section, option) +            value = self.core.config.getPlugin(category, option)          return str(value)      @permission(PERMS.SETTINGS) -    def setConfigValue(self, section, option, value, section="core"): +    def setConfigValue(self, category, option, value, section="core"):          """Set new config value.          :param section: @@ -144,13 +144,13 @@ class Api(Iface):          :param value: new config value          :param section: 'plugin' or 'core          """ -        self.core.addonManager.dispatchEvent("config-changed", section, option, value, section) +        self.core.addonManager.dispatchEvent("config-changed", category, option, value, section)          if section == "core": -            self.core.config.set(section, option, value) +            self.core.config[category][option] = value              if option in ("limit_speed", "max_speed"):  # not so nice to update the limit                  self.core.requestFactory.updateBucket()          elif section == "plugin": -            self.core.config.setPlugin(section, option, value) +            self.core.config.setPlugin(category, option, value)      @permission(PERMS.SETTINGS) diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py index 905ce524e..a081a643e 100644 --- a/pyload/manager/Plugin.py +++ b/pyload/manager/Plugin.py @@ -224,10 +224,12 @@ class PluginManager(object):      def findPlugin(self, type, name): -        if type not in self.plugins: -            return None +        if isinstance(type, tuple): +            for typ in type: +                if name in self.plugins[typ]: +                    return (self.plugins[typ][name], typ) -        elif name not in self.plugins[type]: +        if isinstance(type, tuple) or type not in self.plugins or name not in self.plugins[type]:              self.core.log.warning(_("Plugin [%(type)s] %(name)s not found | Using plugin: [internal] BasePlugin")                                    % {'name': name, 'type': type})              return self.internalPlugins['BasePlugin'] diff --git a/pyload/plugin/internal/MultiHook.py b/pyload/plugin/internal/MultiHook.py index 87b01c13a..f48ae0909 100644 --- a/pyload/plugin/internal/MultiHook.py +++ b/pyload/plugin/internal/MultiHook.py @@ -14,44 +14,44 @@ class MultiHook(Hook):      __version = "0.44"      __config  = [("pluginmode"    , "all;listed;unlisted", "Use for plugins"              , "all"), -                   ("pluginlist"    , "str"                , "Plugin list (comma separated)", ""   ), -                   ("reload"        , "bool"               , "Reload plugin list"           , True ), -                   ("reloadinterval", "int"                , "Reload interval in hours"     , 12   )] +                 ("pluginlist"    , "str"                , "Plugin list (comma separated)", ""), +                 ("reload"        , "bool"               , "Reload plugin list"           , True), +                 ("reloadinterval", "int"                , "Reload interval in hours"     , 12)]      __description = """Hook plugin for multi hoster/crypter"""      __license     = "GPLv3" -    __authors     = [("pyLoad Team"   , "admin@pyload.org" ), -                       ("Walter Purcaro", "vuolter@gmail.com")] +    __authors     = [("pyLoad Team"   , "admin@pyload.org"), +                     ("Walter Purcaro", "vuolter@gmail.com")]      MIN_RELOAD_INTERVAL = 1 * 60 * 60  #: 1 hour      DOMAIN_REPLACEMENTS = [(r'180upload\.com'  , "hundredeightyupload.com"), -                           (r'bayfiles\.net'   , "bayfiles.com"           ), -                           (r'cloudnator\.com' , "shragle.com"            ), -                           (r'dfiles\.eu'      , "depositfiles.com"       ), -                           (r'easy-share\.com' , "crocko.com"             ), -                           (r'freakshare\.net' , "freakshare.com"         ), -                           (r'hellshare\.com'  , "hellshare.cz"           ), -                           (r'ifile\.it'       , "filecloud.io"           ), -                           (r'nowdownload\.\w+', "nowdownload.sx"         ), -                           (r'nowvideo\.\w+'   , "nowvideo.sx"            ), -                           (r'putlocker\.com'  , "firedrive.com"          ), -                           (r'share-?rapid\.cz', "multishare.cz"          ), -                           (r'ul\.to'          , "uploaded.to"            ), -                           (r'uploaded\.net'   , "uploaded.to"            ), -                           (r'uploadhero\.co'  , "uploadhero.com"         ), -                           (r'zshares\.net'    , "zshare.net"             ), -                           (r'^1'              , "one"                    ), -                           (r'^2'              , "two"                    ), -                           (r'^3'              , "three"                  ), -                           (r'^4'              , "four"                   ), -                           (r'^5'              , "five"                   ), -                           (r'^6'              , "six"                    ), -                           (r'^7'              , "seven"                  ), -                           (r'^8'              , "eight"                  ), -                           (r'^9'              , "nine"                   ), -                           (r'^0'              , "zero"                   )] +                           (r'bayfiles\.net'   , "bayfiles.com"), +                           (r'cloudnator\.com' , "shragle.com"), +                           (r'dfiles\.eu'      , "depositfiles.com"), +                           (r'easy-share\.com' , "crocko.com"), +                           (r'freakshare\.net' , "freakshare.com"), +                           (r'hellshare\.com'  , "hellshare.cz"), +                           (r'ifile\.it'       , "filecloud.io"), +                           (r'nowdownload\.\w+', "nowdownload.sx"), +                           (r'nowvideo\.\w+'   , "nowvideo.sx"), +                           (r'putlocker\.com'  , "firedrive.com"), +                           (r'share-?rapid\.cz', "multishare.cz"), +                           (r'ul\.to'          , "uploaded.to"), +                           (r'uploaded\.net'   , "uploaded.to"), +                           (r'uploadhero\.co'  , "uploadhero.com"), +                           (r'zshares\.net'    , "zshare.net"), +                           (r'^1'              , "one"), +                           (r'^2'              , "two"), +                           (r'^3'              , "three"), +                           (r'^4'              , "four"), +                           (r'^5'              , "five"), +                           (r'^6'              , "six"), +                           (r'^7'              , "seven"), +                           (r'^8'              , "eight"), +                           (r'^9'              , "nine"), +                           (r'^0'              , "zero")]      def setup(self): @@ -70,7 +70,7 @@ class MultiHook(Hook):      def initPlugin(self):          self.pluginname         = self.__class__.__name__ -        plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname) +        plugin, self.plugintype = self.core.pluginManager.findPlugin(("hoster", "decrypter", "container"), self.pluginname)          if plugin:              self.pluginmodule = self.core.pluginManager.loadModule(self.plugintype, self.pluginname) @@ -159,7 +159,7 @@ class MultiHook(Hook):          for r in self.DOMAIN_REPLACEMENTS:              rf, rt  = r -            repr    = re.compile(rf, re.I|re.U) +            repr    = re.compile(rf, re.I | re.U)              plugins = [re.sub(rf, rt, p) if repr.match(p) else p for p in plugins]          return set(plugins) diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py index 1604bd576..0d4bbfe51 100644 --- a/pyload/webui/app/pyloadweb.py +++ b/pyload/webui/app/pyloadweb.py @@ -428,7 +428,7 @@ def logs(item=-1):      log = PYLOAD.getLog()      if not perpage: -        item = 0 +        item = 1      if item < 1 or type(item) is not int:          item = 1 if len(log) - perpage + 1 < 1 else len(log) - perpage + 1 | 
