From 84169f4862fa257e0a8a47e5f3578e9ec97ccf4f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 17:01:39 +0200 Subject: Plugins cleanup --- pyload/plugin/addon/ExtractArchive.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'pyload/plugin/addon/ExtractArchive.py') diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index ce67cbcaf..a4a28ab32 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -198,11 +198,11 @@ class ExtractArchive(Addon): while packages: if self.lastPackage: #: called from allDownloadsProcessed self.lastPackage = False - if self.extract(packages, thread): # @NOTE: check only if all gone fine, no failed reporting for now + if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") else: - if self.extract(packages, thread): # @NOTE: check only if all gone fine, no failed reporting for now + if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now pass packages = self.queue.get() #: check for packages added during extraction @@ -234,7 +234,7 @@ class ExtractArchive(Addon): @Expose - def extract(self, ids, thread=None): # @TODO: Use pypack, not pid to improve method usability + def extract(self, ids, thread=None): #@TODO: Use pypack, not pid to improve method usability if not ids: return False @@ -295,7 +295,7 @@ class ExtractArchive(Addon): new_files_ids = [] if extensions: - files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids + files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: @@ -341,7 +341,7 @@ class ExtractArchive(Addon): continue # remove processed file and related multiparts from list - files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids + files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids if fname not in archive.getDeleteFiles()] self.logDebug("Extracted files: %s" % new_files) self.setPermissions(new_files) -- cgit v1.2.3 From 6cdb1ae0fe8f4faf897220d0520ca3e753e9f3e4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 17:48:30 +0200 Subject: [config] Use get method instead dict access --- pyload/plugin/addon/ExtractArchive.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pyload/plugin/addon/ExtractArchive.py') diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index a4a28ab32..26d3f07d9 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -264,7 +264,7 @@ class ExtractArchive(Addon): # reload from txt file self.reloadPasswords() - download_folder = self.config['general']['download_folder'] + download_folder = self.config.get("general", "download_folder") # iterate packages -> extractors -> targets for pid in ids: @@ -551,16 +551,16 @@ class ExtractArchive(Addon): continue try: - if self.config['permission']['change_file']: + if self.config.get("permission", "change_file"): if os.path.isfile(f): - os.chmod(f, int(self.config['permission']['file'], 8)) + os.chmod(f, int(self.config.get("permission", "file"), 8)) elif os.path.isdir(f): - os.chmod(f, int(self.config['permission']['folder'], 8)) + os.chmod(f, int(self.config.get("permission", "folder"), 8)) - if self.config['permission']['change_dl'] and os.name != "nt": - uid = getpwnam(self.config['permission']['user'])[2] - gid = getgrnam(self.config['permission']['group'])[2] + if self.config.get("permission", "change_dl") and os.name != "nt": + uid = getpwnam(self.config.get("permission", "user"))[2] + gid = getgrnam(self.config.get("permission", "group"))[2] os.chown(f, uid, gid) except Exception, e: -- cgit v1.2.3