summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/addon
diff options
context:
space:
mode:
authorGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-13 23:39:24 +0200
committerGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-13 23:39:24 +0200
commit93e8d96a612249bc5f6985740335306969b1a6d3 (patch)
treef89a3b6038344aad70a8abdd178af6af89c9a5a3 /pyload/plugin/addon
parentCleanup (2) (diff)
downloadpyload-93e8d96a612249bc5f6985740335306969b1a6d3.tar.xz
fix: assignJob
fix: typos __name vs. __name__
Diffstat (limited to 'pyload/plugin/addon')
-rw-r--r--pyload/plugin/addon/ExternalScripts.py55
-rw-r--r--pyload/plugin/addon/ExtractArchive.py18
-rw-r--r--pyload/plugin/addon/UpdateManager.py8
3 files changed, 40 insertions, 41 deletions
diff --git a/pyload/plugin/addon/ExternalScripts.py b/pyload/plugin/addon/ExternalScripts.py
index 519023603..75c9ae810 100644
--- a/pyload/plugin/addon/ExternalScripts.py
+++ b/pyload/plugin/addon/ExternalScripts.py
@@ -12,16 +12,15 @@ class ExternalScripts(Addon):
__type = "addon"
__version = "0.39"
- __config = [("activated", "bool", "Activated" , True ),
- ("waitend" , "bool", "Wait script ending", False)]
+ __config = [("activated", "bool", "Activated" , True),
+ ("waitend" , "bool", "Wait script ending", False)]
__description = """Run external scripts"""
__license = "GPLv3"
- __authors = [("mkaay" , "mkaay@mkaay.de" ),
- ("RaNaN" , "ranan@pyload.org" ),
- ("spoob" , "spoob@pyload.org" ),
- ("Walter Purcaro", "vuolter@gmail.com")]
-
+ __authors = [("mkaay" , "mkaay@mkaay.de"),
+ ("RaNaN" , "ranan@pyload.org"),
+ ("spoob" , "spoob@pyload.org"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
event_list = ["archive_extract_failed", "archive_extracted" ,
"package_extract_failed", "package_extracted" ,
@@ -39,7 +38,7 @@ class ExternalScripts(Addon):
"download_preparing", "download_failed", "download_finished",
"archive_extract_failed", "archive_extracted",
"package_finished", "package_deleted", "package_extract_failed", "package_extracted",
- "all_downloads_processed", "all_downloads_finished", #@TODO: Invert `all_downloads_processed`, `all_downloads_finished` order in 0.4.10
+ "all_downloads_processed", "all_downloads_finished", # @TODO: Invert `all_downloads_processed`, `all_downloads_finished` order in 0.4.10
"all_archives_extracted", "all_archives_processed"]
for folder in folders:
@@ -85,7 +84,7 @@ class ExternalScripts(Addon):
self.logDebug("Executing: %s" % os.path.abspath(script), "Args: " + ' '.join(cmd_args))
- p = subprocess.Popen(cmd, bufsize=-1) #@NOTE: output goes to pyload
+ p = subprocess.Popen(cmd, bufsize=-1) # @NOTE: output goes to pyload
if self.getConfig('waitend'):
p.communicate()
@@ -114,7 +113,7 @@ class ExternalScripts(Addon):
def afterReconnecting(self, ip):
for script in self.scripts['after_reconnect']:
- self.callScript(script, ip, self.info['oldip']) #@TODO: Use built-in oldip in 0.4.10
+ self.callScript(script, ip, self.info['oldip']) # @TODO: Use built-in oldip in 0.4.10
def downloadPreparing(self, pyfile):
@@ -123,10 +122,10 @@ class ExternalScripts(Addon):
def downloadFailed(self, pyfile):
- if self.config['general']['folder_per_package']:
- download_folder = fs_join(self.config['general']['download_folder'], pyfile.package().folder)
+ if self.core.config['general']['folder_per_package']:
+ download_folder = fs_join(self.core.config['general']['download_folder'], pyfile.package().folder)
else:
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
for script in self.scripts['download_failed']:
file = fs_join(download_folder, pyfile.name)
@@ -134,10 +133,10 @@ class ExternalScripts(Addon):
def downloadFinished(self, pyfile):
- if self.config['general']['folder_per_package']:
- download_folder = fs_join(self.config['general']['download_folder'], pyfile.package().folder)
+ if self.core.config['general']['folder_per_package']:
+ download_folder = fs_join(self.core.config['general']['download_folder'], pyfile.package().folder)
else:
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
for script in self.scripts['download_finished']:
file = fs_join(download_folder, pyfile.name)
@@ -155,10 +154,10 @@ class ExternalScripts(Addon):
def packageFinished(self, pypack):
- if self.config['general']['folder_per_package']:
- download_folder = fs_join(self.config['general']['download_folder'], pypack.folder)
+ if self.core.config['general']['folder_per_package']:
+ download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder)
else:
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
for script in self.scripts['package_finished']:
self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password)
@@ -167,30 +166,30 @@ class ExternalScripts(Addon):
def packageDeleted(self, pid):
pack = self.core.api.getPackageInfo(pid)
- if self.config['general']['folder_per_package']:
- download_folder = fs_join(self.config['general']['download_folder'], pack.folder)
+ if self.core.config['general']['folder_per_package']:
+ download_folder = fs_join(self.core.config['general']['download_folder'], pack.folder)
else:
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
for script in self.scripts['package_deleted']:
self.callScript(script, pack.id, pack.name, download_folder, pack.password)
def package_extract_failed(self, pypack):
- if self.config['general']['folder_per_package']:
- download_folder = fs_join(self.config['general']['download_folder'], pypack.folder)
+ if self.core.config['general']['folder_per_package']:
+ download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder)
else:
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
for script in self.scripts['package_extract_failed']:
self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password)
def package_extracted(self, pypack):
- if self.config['general']['folder_per_package']:
- download_folder = fs_join(self.config['general']['download_folder'], pypack.folder)
+ if self.core.config['general']['folder_per_package']:
+ download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder)
else:
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
for script in self.scripts['package_extracted']:
self.callScript(script, pypack.id, pypack.name, download_folder)
diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py
index b2eeec1a3..ce67cbcaf 100644
--- a/pyload/plugin/addon/ExtractArchive.py
+++ b/pyload/plugin/addon/ExtractArchive.py
@@ -186,7 +186,7 @@ class ExtractArchive(Addon):
traceback.print_exc()
if self.extractors:
- self.logDebug(*["Found %s %s" % (Extractor.__name, Extractor.VERSION) for Extractor in self.extractors])
+ self.logDebug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors])
self.extractQueued() #: Resume unfinished extractions
else:
self.logInfo(_("No Extract plugins activated"))
@@ -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
@@ -287,15 +287,15 @@ class ExtractArchive(Addon):
matched = False
success = True
- files_ids = dict((pylink['name'],((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \
- in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: remove duplicates
+ files_ids = dict((pylink['name'], ((fs_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink
+ in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values() #: remove duplicates
# check as long there are unseen files
while files_ids:
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,8 +341,8 @@ class ExtractArchive(Addon):
continue
# remove processed file and related multiparts from list
- files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \
- if fname not in archive.getDeleteFiles()]
+ 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)
diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py
index c7fb27a3d..60fc71d0a 100644
--- a/pyload/plugin/addon/UpdateManager.py
+++ b/pyload/plugin/addon/UpdateManager.py
@@ -87,15 +87,15 @@ class UpdateManager(Addon):
def autoreloadPlugins(self):
""" reload and reindex all modified plugins """
modules = filter(
- lambda m: m and (m.__name.startswith("pyload.plugin.") or
- m.__name.startswith("userplugins.")) and
- m.__name.count(".") >= 2, sys.modules.itervalues()
+ lambda m: m and (m.__name__.startswith("pyload.plugin.") or
+ m.__name__.startswith("userplugins.")) and
+ m.__name__.count(".") >= 2, sys.modules.itervalues()
)
reloads = []
for m in modules:
- root, type, name = m.__name.rsplit(".", 2)
+ root, type, name = m.__name__.rsplit(".", 2)
id = (type, name)
if type in self.core.pluginManager.plugins:
f = m.__file__.replace(".pyc", ".py")