diff options
Diffstat (limited to 'module/plugins/internal')
| -rw-r--r-- | module/plugins/internal/AbstractExtractor.py | 8 | ||||
| -rw-r--r-- | module/plugins/internal/MultiHoster.py | 11 | ||||
| -rw-r--r-- | module/plugins/internal/SimpleCrypter.py | 1 | ||||
| -rw-r--r-- | module/plugins/internal/UnZip.py | 3 | 
4 files changed, 23 insertions, 0 deletions
diff --git a/module/plugins/internal/AbstractExtractor.py b/module/plugins/internal/AbstractExtractor.py index 2b21ee357..8282e6ff5 100644 --- a/module/plugins/internal/AbstractExtractor.py +++ b/module/plugins/internal/AbstractExtractor.py @@ -28,6 +28,7 @@ class AbtractExtractor:          """          return True +      @staticmethod      def getTargets(files_ids):          """ Filter suited targets from list of filename id tuple list @@ -36,6 +37,7 @@ class AbtractExtractor:          """          raise NotImplementedError +      def __init__(self, m, file, out, fullpath, overwrite, excludefiles, renice):          """Initialize extractor for specific file @@ -55,10 +57,12 @@ class AbtractExtractor:          self.renice = renice          self.files = []  #: Store extracted files here +      def init(self):          """ Initialize additional data structures """          pass +      def checkArchive(self):          """Check if password if needed. Raise ArchiveError if integrity is          questionable. @@ -68,6 +72,7 @@ class AbtractExtractor:          """          return False +      def checkPassword(self, password):          """ Check if the given password is/might be correct.          If it can not be decided at this point return true. @@ -77,6 +82,7 @@ class AbtractExtractor:          """          return True +      def extract(self, progress, password=None):          """Extract the archive. Raise specific errors in case of failure. @@ -89,6 +95,7 @@ class AbtractExtractor:          """          raise NotImplementedError +      def getDeleteFiles(self):          """Return list of files to delete, do *not* delete them here. @@ -96,6 +103,7 @@ class AbtractExtractor:          """          raise NotImplementedError +      def getExtractedFiles(self):          """Populate self.files at some point while extracting"""          return self.files diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 4ef43bc31..5aadf6f2e 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -28,6 +28,7 @@ class MultiHoster(Hook):          self.supported = []          self.new_supported = [] +      def getConfig(self, option, default=''):          """getConfig with default value - sublass may not implements all config options"""          try: @@ -35,6 +36,7 @@ class MultiHoster(Hook):          except KeyError:              return default +      def getHosterCached(self):          if not self.hosters: @@ -61,6 +63,7 @@ class MultiHoster(Hook):          return self.hosters +      def toHosterSet(self, hosters):          hosters = set((str(x).strip().lower() for x in hosters)) @@ -72,6 +75,7 @@ class MultiHoster(Hook):          hosters.discard('')          return hosters +      def getHoster(self):          """Load list of supported hoster @@ -79,6 +83,7 @@ class MultiHoster(Hook):          """          raise NotImplementedError +      def coreReady(self):          if self.cb:              self.core.scheduler.removeJob(self.cb) @@ -94,9 +99,11 @@ class MultiHoster(Hook):          else:              self.periodical() +      def initPeriodical(self):          pass +      def periodical(self):          """reload hoster list periodically"""          self.logInfo(_("Reloading supported hoster list")) @@ -112,6 +119,7 @@ class MultiHoster(Hook):              for hoster in old_supported:                  self.unloadHoster(hoster) +      def overridePlugins(self):          pluginMap = {}          for name in self.core.pluginManager.hosterPlugins.keys(): @@ -162,6 +170,7 @@ class MultiHoster(Hook):              dict['pattern'] = regexp              dict['re'] = re.compile(regexp) +      def unloadHoster(self, hoster):          dict = self.core.pluginManager.hosterPlugins[hoster]          if "module" in dict: @@ -171,6 +180,7 @@ class MultiHoster(Hook):              del dict['new_module']              del dict['new_name'] +      def unload(self):          """Remove override for all hosters. Scheduler job is removed by hookmanager"""          for hoster in self.supported: @@ -182,6 +192,7 @@ class MultiHoster(Hook):          dict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$')          dict['re'] = re.compile(dict['pattern']) +      def downloadFailed(self, pyfile):          """remove plugin override if download fails but not if file is offline/temp.offline"""          if pyfile.hasStatus("failed") and self.getConfig("unloadFailing", True): diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 613ffce1f..6c00a2267 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -51,6 +51,7 @@ class SimpleCrypter(Crypter):      and its loadPage method: +        def loadPage(self, page_n):            return the html of the page number page_n      """ diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index 52b4bca27..ec493bcd8 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -19,6 +19,7 @@ class UnZip(AbtractExtractor):      def checkDeps():          return sys.version_info[:2] >= (2, 6) +      @staticmethod      def getTargets(files_ids):          result = [] @@ -29,10 +30,12 @@ class UnZip(AbtractExtractor):          return result +      def extract(self, progress, password=None):          z = zipfile.ZipFile(self.file)          self.files = z.namelist()          z.extractall(self.out) +      def getDeleteFiles(self):          return [self.file]  | 
