summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-16 21:02:39 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-16 21:02:39 +0200
commitbdb90b74ed973e9d61c9c6fd35d98ffe4c2d4c20 (patch)
tree896ff1eaae9151d83be150735c96a37a61d2d038
parent[api] Improve getConfigValue (diff)
parentfixed: more typos (diff)
downloadpyload-bdb90b74ed973e9d61c9c6fd35d98ffe4c2d4c20.tar.xz
Merge pull request #5 from ardi69/0.4.10
fix: assignJob and typos (__name vs. __name__) [2]
-rw-r--r--pyload/manager/Thread.py6
-rw-r--r--pyload/manager/thread/Download.py1
-rw-r--r--pyload/manager/thread/Plugin.py3
-rw-r--r--pyload/plugin/addon/ExtractArchive.py38
-rw-r--r--pyload/plugin/crypter/XFileSharingPro.py6
-rw-r--r--pyload/plugin/hook/BypassCaptcha.py16
-rw-r--r--pyload/plugin/hook/CaptchaBrotherhood.py14
-rw-r--r--pyload/plugin/hook/DeathByCaptcha.py8
-rw-r--r--pyload/plugin/hook/ImageTyperz.py10
-rw-r--r--pyload/plugin/hoster/FileserveCom.py10
-rw-r--r--pyload/plugin/hoster/NoPremiumPl.py2
-rw-r--r--pyload/plugin/hoster/RapideoPl.py2
-rw-r--r--pyload/plugin/hoster/XFileSharingPro.py4
-rw-r--r--pyload/plugin/hoster/Xdcc.py2
-rw-r--r--pyload/webui/app/pyloadweb.py2
15 files changed, 63 insertions, 61 deletions
diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py
index 1f1a2dc5c..015bc9ab1 100644
--- a/pyload/manager/Thread.py
+++ b/pyload/manager/Thread.py
@@ -257,11 +257,11 @@ class ThreadManager(object):
free = [x for x in self.threads if not x.active]
- inuse = set([((x.active.plugintype, x.active.pluginname), self.getLimit(x)) for x in self.threads if x.active and x.active.hasPlugin() and x.active.plugin.account])
- inuse = map(lambda x: ('.'.join(x[0]), x[1], len([y for y in self.threads if y.active and y.active.plugintype == x[0][0] and y.active.pluginname == x[0][1]])), inuse)
+ inuse = set([((x.active.plugintype, x.active.pluginname), self.getLimit(x)) for x in self.threads if x.active and isinstance(x.active, PyFile) and x.active.hasPlugin() and x.active.plugin.account])
+ inuse = map(lambda x: ('.'.join(x[0]), x[1], len([y for y in self.threads if y.active and isinstance(y.active, PyFile) and y.active.plugintype == x[0][0] and y.active.pluginname == x[0][1]])), inuse)
onlimit = [x[0] for x in inuse if x[1] > 0 and x[2] >= x[1]]
- occ = [x.active.plugintype + '.' + x.active.pluginname for x in self.threads if x.active and x.active.hasPlugin() and not x.active.plugin.multiDL] + onlimit
+ occ = [x.active.plugintype + '.' + x.active.pluginname for x in self.threads if x.active and isinstance(x.active, PyFile) and x.active.hasPlugin() and not x.active.plugin.multiDL] + onlimit
occ.sort()
occ = tuple(set(occ))
diff --git a/pyload/manager/thread/Download.py b/pyload/manager/thread/Download.py
index fc76b655e..21db61ca4 100644
--- a/pyload/manager/thread/Download.py
+++ b/pyload/manager/thread/Download.py
@@ -39,6 +39,7 @@ class DownloadThread(PluginThread):
while True:
del pyfile
+ self.active = False # sets the thread inactive when it is ready to get next job
self.active = self.queue.get()
pyfile = self.active
diff --git a/pyload/manager/thread/Plugin.py b/pyload/manager/thread/Plugin.py
index d5b4cfefe..08a2664da 100644
--- a/pyload/manager/thread/Plugin.py
+++ b/pyload/manager/thread/Plugin.py
@@ -20,6 +20,7 @@ from pyload.utils.packagetools import parseNames
from pyload.utils import fs_join
from pyload.api import OnlineStatus
+
class PluginThread(Thread):
"""abstract base class for thread types"""
@@ -127,5 +128,5 @@ class PluginThread(Thread):
def clean(self, pyfile):
""" set thread unactive and release pyfile """
- self.active = False
+ self.active = True #release pyfile but lets the thread active
pyfile.release()
diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py
index 26d3f07d9..a106d22ab 100644
--- a/pyload/plugin/addon/ExtractArchive.py
+++ b/pyload/plugin/addon/ExtractArchive.py
@@ -112,30 +112,30 @@ class ExtractArchive(Addon):
__version = "1.41"
__config = [("activated" , "bool" , "Activated" , True ),
- ("fullpath" , "bool" , "Extract with full paths" , True ),
- ("overwrite" , "bool" , "Overwrite files" , False ),
- ("keepbroken" , "bool" , "Try to extract broken archives" , False ),
- ("repair" , "bool" , "Repair broken archives (RAR required)" , False ),
- ("test" , "bool" , "Test archive before extracting" , False ),
- ("usepasswordfile", "bool" , "Use password file" , True ),
- ("passwordfile" , "file" , "Password file" , "archive_password.txt" ),
- ("delete" , "bool" , "Delete archive after extraction" , True ),
- ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ),
- ("subfolder" , "bool" , "Create subfolder for each package" , False ),
- ("destination" , "folder" , "Extract files to folder" , "" ),
- ("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"),
- ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ),
- ("recursive" , "bool" , "Extract archives in archives" , True ),
- ("waitall" , "bool" , "Run after all downloads was processed" , False ),
- ("renice" , "int" , "CPU priority" , 0 )]
+ ("fullpath" , "bool" , "Extract with full paths" , True ),
+ ("overwrite" , "bool" , "Overwrite files" , False ),
+ ("keepbroken" , "bool" , "Try to extract broken archives" , False ),
+ ("repair" , "bool" , "Repair broken archives (RAR required)" , False ),
+ ("test" , "bool" , "Test archive before extracting" , False ),
+ ("usepasswordfile", "bool" , "Use password file" , True ),
+ ("passwordfile" , "file" , "Password file" , "archive_password.txt" ),
+ ("delete" , "bool" , "Delete archive after extraction" , True ),
+ ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ),
+ ("subfolder" , "bool" , "Create subfolder for each package" , False ),
+ ("destination" , "folder" , "Extract files to folder" , "" ),
+ ("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"),
+ ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ),
+ ("recursive" , "bool" , "Extract archives in archives" , True ),
+ ("waitall" , "bool" , "Run after all downloads was processed" , False ),
+ ("renice" , "int" , "CPU priority" , 0 )]
__description = """Extract different kind of archives"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz" , "immenz@gmx.net" )]
+ ("Immenz" , "immenz@gmx.net" )]
- event_list = ["allDownloadsProcessed","packageDeleted"]
+ event_list = ["allDownloadsProcessed", "packageDeleted"]
NAME_REPLACEMENTS = [(r'\.part\d+\.rar$', ".part.rar")]
@@ -301,7 +301,7 @@ class ExtractArchive(Addon):
for Extractor in self.extractors:
targets = Extractor.getTargets(files_ids)
if targets:
- self.logDebug("Targets for %s: %s" % (Extractor.__class__.__name__, targets))
+ self.logDebug("Targets for %s: %s" % (Extractor.__name__, targets))
matched = True
for fname, fid, fout in targets:
diff --git a/pyload/plugin/crypter/XFileSharingPro.py b/pyload/plugin/crypter/XFileSharingPro.py
index 9422789f3..c83c0c67e 100644
--- a/pyload/plugin/crypter/XFileSharingPro.py
+++ b/pyload/plugin/crypter/XFileSharingPro.py
@@ -12,7 +12,7 @@ class XFileSharingPro(XFSCrypter):
__pattern = r'^unmatchable$'
__config = [("use_subfolder" , "bool", "Save package to subfolder" , True),
- ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
+ ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
__description = """XFileSharingPro dummy folder decrypter plugin for hook"""
__license = "GPLv3"
@@ -22,13 +22,13 @@ class XFileSharingPro(XFSCrypter):
def _log(self, type, args):
msg = " | ".join(str(a).strip() for a in args if a)
logger = getattr(self.log, type)
- logger("%s: %s: %s" % (self.__name, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
+ logger("%s: %s: %s" % (self.__class__.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
def init(self):
super(XFileSharingPro, self).init()
- self.__pattern = self.core.pluginManager.crypterPlugins[self.__name]['pattern']
+ self.__pattern = self.core.pluginManager.crypterPlugins[self.__class__.__name__]['pattern']
self.HOSTER_DOMAIN = re.match(self.__pattern, self.pyfile.url).group("DOMAIN").lower()
self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
diff --git a/pyload/plugin/hook/BypassCaptcha.py b/pyload/plugin/hook/BypassCaptcha.py
index 141ac7282..e3fae426e 100644
--- a/pyload/plugin/hook/BypassCaptcha.py
+++ b/pyload/plugin/hook/BypassCaptcha.py
@@ -35,9 +35,9 @@ class BypassCaptcha(Hook):
__description = """Send captchas to BypassCaptcha.com"""
__license = "GPLv3"
- __authors = [("RaNaN" , "RaNaN@pyload.org" ),
- ("Godofdream", "soilfcition@gmail.com"),
- ("zoidberg" , "zoidberg@mujmail.cz" )]
+ __authors = [("RaNaN" , "RaNaN@pyload.org"),
+ ("Godofdream", "soilfcition@gmail.com"),
+ ("zoidberg" , "zoidberg@mujmail.cz")]
PYLOAD_KEY = "4f771155b640970d5607f919a615bdefc67e7d32"
@@ -84,7 +84,7 @@ class BypassCaptcha(Hook):
def respond(self, ticket, success):
try:
res = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig('passkey'),
- "cv": 1 if success else 0})
+ "cv": 1 if success else 0})
except BadHeader, e:
self.logError(_("Could not send response"), e)
@@ -104,21 +104,21 @@ class BypassCaptcha(Hook):
if self.getCredits() > 0:
task.handler.append(self)
- task.data['service'] = self.__name
+ task.data['service'] = self.__class__.__name__
task.setWaiting(100)
self._processCaptcha(task)
else:
- self.logInfo(_("Your %s account has not enough credits") % self.__name)
+ self.logInfo(_("Your %s account has not enough credits") % self.__class__.__name__)
def captchaCorrect(self, task):
- if task.data['service'] == self.__name and "ticket" in task.data:
+ if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
self.respond(task.data['ticket'], True)
def captchaInvalid(self, task):
- if task.data['service'] == self.__name and "ticket" in task.data:
+ if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
self.respond(task.data['ticket'], False)
diff --git a/pyload/plugin/hook/CaptchaBrotherhood.py b/pyload/plugin/hook/CaptchaBrotherhood.py
index eff005d14..15338b0af 100644
--- a/pyload/plugin/hook/CaptchaBrotherhood.py
+++ b/pyload/plugin/hook/CaptchaBrotherhood.py
@@ -46,8 +46,8 @@ class CaptchaBrotherhood(Hook):
__description = """Send captchas to CaptchaBrotherhood.com"""
__license = "GPLv3"
- __authors = [("RaNaN" , "RaNaN@pyload.org" ),
- ("zoidberg", "zoidberg@mujmail.cz")]
+ __authors = [("RaNaN" , "RaNaN@pyload.org"),
+ ("zoidberg", "zoidberg@mujmail.cz")]
API_URL = "http://www.captchabrotherhood.com/"
@@ -123,9 +123,9 @@ class CaptchaBrotherhood(Hook):
def api_response(self, api, ticket):
res = getURL("%s%s.aspx" % (self.API_URL, api),
- get={"username": self.getConfig('username'),
- "password": self.getConfig('passkey'),
- "captchaID": ticket})
+ get={"username": self.getConfig('username'),
+ "password": self.getConfig('passkey'),
+ "captchaID": ticket})
if not res.startswith("OK"):
raise CaptchaBrotherhoodException("Unknown response: %s" % res)
@@ -147,7 +147,7 @@ class CaptchaBrotherhood(Hook):
if self.getCredits() > 10:
task.handler.append(self)
- task.data['service'] = self.__name
+ task.data['service'] = self.__class__.__name__
task.setWaiting(100)
self._processCaptcha(task)
else:
@@ -155,7 +155,7 @@ class CaptchaBrotherhood(Hook):
def captchaInvalid(self, task):
- if task.data['service'] == self.__name and "ticket" in task.data:
+ if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
res = self.api_response("complainCaptcha", task.data['ticket'])
diff --git a/pyload/plugin/hook/DeathByCaptcha.py b/pyload/plugin/hook/DeathByCaptcha.py
index 4b77c8718..b28848422 100644
--- a/pyload/plugin/hook/DeathByCaptcha.py
+++ b/pyload/plugin/hook/DeathByCaptcha.py
@@ -59,8 +59,8 @@ class DeathByCaptcha(Hook):
__description = """Send captchas to DeathByCaptcha.com"""
__license = "GPLv3"
- __authors = [("RaNaN" , "RaNaN@pyload.org" ),
- ("zoidberg", "zoidberg@mujmail.cz")]
+ __authors = [("RaNaN" , "RaNaN@pyload.org"),
+ ("zoidberg", "zoidberg@mujmail.cz")]
API_URL = "http://api.dbcapi.me/api/"
@@ -188,13 +188,13 @@ class DeathByCaptcha(Hook):
if balance > rate:
task.handler.append(self)
- task.data['service'] = self.__name
+ task.data['service'] = self.__class__.__name__
task.setWaiting(180)
self._processCaptcha(task)
def captchaInvalid(self, task):
- if task.data['service'] == self.__name and "ticket" in task.data:
+ if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
try:
res = self.api_response("captcha/%d/report" % task.data['ticket'], True)
diff --git a/pyload/plugin/hook/ImageTyperz.py b/pyload/plugin/hook/ImageTyperz.py
index ca5e02559..5dadc09f1 100644
--- a/pyload/plugin/hook/ImageTyperz.py
+++ b/pyload/plugin/hook/ImageTyperz.py
@@ -40,8 +40,8 @@ class ImageTyperz(Hook):
__description = """Send captchas to ImageTyperz.com"""
__license = "GPLv3"
- __authors = [("RaNaN" , "RaNaN@pyload.org" ),
- ("zoidberg", "zoidberg@mujmail.cz")]
+ __authors = [("RaNaN" , "RaNaN@pyload.org"),
+ ("zoidberg", "zoidberg@mujmail.cz")]
SUBMIT_URL = "http://captchatypers.com/Forms/UploadFileAndGetTextNEW.ashx"
@@ -118,16 +118,16 @@ class ImageTyperz(Hook):
if self.getCredits() > 0:
task.handler.append(self)
- task.data['service'] = self.__name
+ task.data['service'] = self.__class__.__name__
task.setWaiting(100)
self._processCaptcha(task)
else:
- self.logInfo(_("Your %s account has not enough credits") % self.__name)
+ self.logInfo(_("Your %s account has not enough credits") % self.__class__.__name__)
def captchaInvalid(self, task):
- if task.data['service'] == self.__name and "ticket" in task.data:
+ if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
res = getURL(self.RESPOND_URL,
post={'action': "SETBADIMAGE",
'username': self.getConfig('username'),
diff --git a/pyload/plugin/hoster/FileserveCom.py b/pyload/plugin/hoster/FileserveCom.py
index b275f6e86..a7bb22440 100644
--- a/pyload/plugin/hoster/FileserveCom.py
+++ b/pyload/plugin/hoster/FileserveCom.py
@@ -40,9 +40,9 @@ class FileserveCom(Hoster):
__description = """Fileserve.com hoster plugin"""
__license = "GPLv3"
__authors = [("jeix", "jeix@hasnomail.de"),
- ("mkaay", "mkaay@mkaay.de"),
- ("Paul King", ""),
- ("zoidberg", "zoidberg@mujmail.cz")]
+ ("mkaay", "mkaay@mkaay.de"),
+ ("Paul King", ""),
+ ("zoidberg", "zoidberg@mujmail.cz")]
URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php",
@@ -144,7 +144,7 @@ class FileserveCom(Hoster):
if "fail" in res:
self.fail(_("Failed getting wait time"))
- if self.__name == "FilejungleCom":
+ if self.__class__.__name__ == "FilejungleCom":
m = re.search(r'"waitTime":(\d+)', res)
if m is None:
self.fail(_("Cannot get wait time"))
@@ -184,7 +184,7 @@ class FileserveCom(Hoster):
def handlePremium(self, pyfile):
premium_url = None
- if self.__name == "FileserveCom":
+ if self.__class__.__name__ == "FileserveCom":
#try api download
res = self.load("http://app.fileserve.com/api/download/premium/",
post={"username": self.user,
diff --git a/pyload/plugin/hoster/NoPremiumPl.py b/pyload/plugin/hoster/NoPremiumPl.py
index 701ca6a6d..109932721 100644
--- a/pyload/plugin/hoster/NoPremiumPl.py
+++ b/pyload/plugin/hoster/NoPremiumPl.py
@@ -79,7 +79,7 @@ class NoPremiumPl(MultiHoster):
if "errno" in parsed.keys():
if parsed["errno"] in self.ERROR_CODES:
# error code in known
- self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name)
+ self.fail(self.ERROR_CODES[parsed["errno"]] % self.__class__.__name__)
else:
# error code isn't yet added to plugin
self.fail(
diff --git a/pyload/plugin/hoster/RapideoPl.py b/pyload/plugin/hoster/RapideoPl.py
index 88a596dc7..70e3fd853 100644
--- a/pyload/plugin/hoster/RapideoPl.py
+++ b/pyload/plugin/hoster/RapideoPl.py
@@ -79,7 +79,7 @@ class RapideoPl(MultiHoster):
if "errno" in parsed.keys():
if parsed["errno"] in self.ERROR_CODES:
# error code in known
- self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name)
+ self.fail(self.ERROR_CODES[parsed["errno"]] % self.__class__.__name__)
else:
# error code isn't yet added to plugin
self.fail(
diff --git a/pyload/plugin/hoster/XFileSharingPro.py b/pyload/plugin/hoster/XFileSharingPro.py
index 0696674df..8274a818a 100644
--- a/pyload/plugin/hoster/XFileSharingPro.py
+++ b/pyload/plugin/hoster/XFileSharingPro.py
@@ -23,13 +23,13 @@ class XFileSharingPro(XFSHoster):
def _log(self, type, args):
msg = " | ".join(str(a).strip() for a in args if a)
logger = getattr(self.log, type)
- logger("%s: %s: %s" % (self.__name, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
+ logger("%s: %s: %s" % (self.__class__.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
def init(self):
super(XFileSharingPro, self).init()
- self.__pattern = self.core.pluginManager.hosterPlugins[self.__name]['pattern']
+ self.__pattern = self.core.pluginManager.hosterPlugins[self.__class__.__name__]['pattern']
self.HOSTER_DOMAIN = re.match(self.__pattern, self.pyfile.url).group("DOMAIN").lower()
self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py
index eda518150..f2b5d0b8f 100644
--- a/pyload/plugin/hoster/Xdcc.py
+++ b/pyload/plugin/hoster/Xdcc.py
@@ -36,7 +36,7 @@ class Xdcc(Hoster):
def process(self, pyfile):
# change request type
- self.req = pyfile.m.core.requestFactory.getRequest(self.__name, type="XDCC")
+ self.req = pyfile.m.core.requestFactory.getRequest(self.__class__.__name__, type="XDCC")
self.pyfile = pyfile
for _i in xrange(0, 3):
diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py
index f04c6906b..cc2185fd4 100644
--- a/pyload/webui/app/pyloadweb.py
+++ b/pyload/webui/app/pyloadweb.py
@@ -256,7 +256,7 @@ def config():
name, none, type = desc.partition("_")
if type in PYLOAD.core.pluginManager.TYPES:
- if name != last_name or len([a for a, b in plugin.iteritems() if b.description.startswith(name + "_")]) > 1:
+ if name == last_name or len([a for a, b in plugin.iteritems() if b.description.startswith(name + "_")]) > 1:
desc = name + " (" + type.title() + ")"
else:
desc = name