summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-07-14 20:59:01 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-07-14 20:59:01 +0200
commit853d29a0f12cdcb6c406b829a57439c7ea9b570d (patch)
tree047d94a11037617521c7a50130a6ead538c5daf7 /module/plugins
parentfixed config on webif + show description (diff)
downloadpyload-853d29a0f12cdcb6c406b829a57439c7ea9b570d.tar.xz
has_key refractored, package name generator by Geek
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/Account.py28
-rw-r--r--module/plugins/AccountManager.py8
-rw-r--r--module/plugins/Plugin.py4
-rw-r--r--module/plugins/PluginManager.py30
-rw-r--r--module/plugins/crypter/SerienjunkiesOrg.py4
-rw-r--r--module/plugins/hooks/CaptchaTrader.py4
-rw-r--r--module/plugins/hooks/Ev0InFetcher.py2
-rw-r--r--module/plugins/hooks/MultiHome.py2
-rw-r--r--module/plugins/hooks/RealdebridCom.py2
-rw-r--r--module/plugins/hooks/RehostTo.py4
-rw-r--r--module/plugins/hooks/UpdateManager.py2
-rw-r--r--module/plugins/hoster/UploadedTo.py4
12 files changed, 47 insertions, 47 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py
index adee39559..86d4b8335 100644
--- a/module/plugins/Account.py
+++ b/module/plugins/Account.py
@@ -93,7 +93,7 @@ class Account():
if req:
req.cj.clear()
req.close()
- if self.infos.has_key(user):
+ if user in self.infos:
del self.infos[user] #delete old information
self._login(user, self.accounts[user])
@@ -107,7 +107,7 @@ class Account():
def updateAccounts(self, user, password=None, options={}):
""" updates account and return true if anything changed """
- if self.accounts.has_key(user):
+ if user in self.accounts:
self.accounts[user]["valid"] = True #do not remove or accounts will not login
if password:
self.accounts[user]["password"] = password
@@ -123,11 +123,11 @@ class Account():
return True
def removeAccount(self, user):
- if self.accounts.has_key(user):
+ if user in self.accounts:
del self.accounts[user]
- if self.infos.has_key(user):
+ if user in self.infos:
del self.infos[user]
- if self.timestamps.has_key(user):
+ if user in self.timestamps:
del self.timestamps[user]
def getAccountInfo(self, name, force=False):
@@ -140,7 +140,7 @@ class Account():
"""
data = Account.loadAccountInfo(self, name)
- if force or not self.infos.has_key(name):
+ if force or name not in self.infos:
self.logDebug("Get Account Info for %s" % name)
req = self.getAccountRequest(name)
@@ -157,7 +157,7 @@ class Account():
infos["timestamp"] = time()
self.infos[name] = infos
- elif self.infos[name].has_key("timestamp") and self.infos[name][
+ elif "timestamp" in self.infos[name] and self.infos[name][
"timestamp"] + self.info_threshold * 60 < time():
self.scheduleRefresh(name)
@@ -219,7 +219,7 @@ class Account():
for user, data in self.accounts.iteritems():
if not data["valid"]: continue
- if data["options"].has_key("time") and data["options"]["time"]:
+ if "time" in data["options"] and data["options"]["time"]:
time_data = ""
try:
time_data = data["options"]["time"][0]
@@ -229,11 +229,11 @@ class Account():
except:
self.logWarning(_("Your Time %s has wrong format, use: 1:22-3:44") % time_data)
- if self.infos.has_key(user):
- if self.infos[user].has_key("validuntil"):
+ if user in self.infos:
+ if "validuntil" in self.infos[user]:
if self.infos[user]["validuntil"] > 0 and time() > self.infos[user]["validuntil"]:
continue
- if self.infos[user].has_key("trafficleft"):
+ if "trafficleft" in self.infos[user]:
if self.infos[user]["trafficleft"] == 0:
continue
@@ -252,14 +252,14 @@ class Account():
raise WrongPassword
def empty(self, user):
- if self.infos.has_key(user):
+ if user in self.infos:
self.logWarning(_("Account %s has not enough traffic, checking again in 30min") % user)
self.infos[user].update({"trafficleft": 0})
self.scheduleRefresh(user, 30 * 60)
def expired(self, user):
- if self.infos.has_key(user):
+ if user in self.infos:
self.logWarning(_("Account %s is expired, checking again in 1h") % user)
self.infos[user].update({"validuntil": time() - 1})
@@ -272,7 +272,7 @@ class Account():
def checkLogin(self, user):
""" checks if user is still logged in """
- if self.timestamps.has_key(user):
+ if user in self.timestamps:
if self.timestamps[user] + self.login_timeout * 60 < time():
self.logDebug("Reached login timeout for %s" % user)
self.relogin(user)
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py
index 94af7cd82..4b218d8f8 100644
--- a/module/plugins/AccountManager.py
+++ b/module/plugins/AccountManager.py
@@ -49,8 +49,8 @@ class AccountManager():
#----------------------------------------------------------------------
def getAccountPlugin(self, plugin):
"""get account instance for plugin or None if anonymous"""
- if self.accounts.has_key(plugin):
- if not self.plugins.has_key(plugin):
+ if plugin in self.accounts:
+ if plugin not in self.plugins:
self.plugins[plugin] = self.core.pluginManager.getAccountPlugin(plugin)(self, self.accounts[plugin])
return self.plugins[plugin]
@@ -143,7 +143,7 @@ class AccountManager():
@lock
def updateAccount(self, plugin , user, password=None, options={}):
"""add or update account"""
- if self.accounts.has_key(plugin):
+ if plugin in self.accounts:
p = self.getAccountPlugin(plugin)
updated = p.updateAccounts(user, password, options)
#since accounts is a ref in plugin self.accounts doesnt need to be updated here
@@ -155,7 +155,7 @@ class AccountManager():
def removeAccount(self, plugin, user):
"""remove account"""
- if self.accounts.has_key(plugin):
+ if plugin in self.accounts:
p = self.getAccountPlugin(plugin)
p.removeAccount(user)
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py
index ec8a0151a..c1b6684af 100644
--- a/module/plugins/Plugin.py
+++ b/module/plugins/Plugin.py
@@ -300,7 +300,7 @@ class Plugin(object):
temp_file.write(img)
temp_file.close()
- has_plugin = self.core.pluginManager.captchaPlugins.has_key(self.__name__)
+ has_plugin = self.__name__ in self.core.pluginManager.captchaPlugins
if self.core.captcha:
Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__)
@@ -398,7 +398,7 @@ class Plugin(object):
key = key.lower().strip()
value = value.strip()
- if header.has_key(key):
+ if key in header:
if type(header[key]) == list:
header[key].append(value)
else:
diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py
index 17405ce8b..333f9e247 100644
--- a/module/plugins/PluginManager.py
+++ b/module/plugins/PluginManager.py
@@ -130,7 +130,7 @@ class PluginManager():
else:
version = 0
- if home and home.has_key(name):
+ if home and name in home:
if home[name]["v"] >= version:
continue
@@ -223,17 +223,17 @@ class PluginManager():
"""return plugin module from hoster|decrypter|container"""
plugin = None
- if self.containerPlugins.has_key(name):
+ if name in self.containerPlugins:
plugin = self.containerPlugins[name]
- if self.crypterPlugins.has_key(name):
+ if name in self.crypterPlugins:
plugin = self.crypterPlugins[name]
- if self.hosterPlugins.has_key(name):
+ if name in self.hosterPlugins:
plugin = self.hosterPlugins[name]
- if plugin.has_key("new_module") and not original:
+ if "new_module" in plugin and not original:
return plugin["new_module"]
- if plugin.has_key("module"):
+ if "module" in plugin:
return plugin["module"]
plugin["module"] = __import__(plugin["path"], globals(), locals(), [plugin["name"]], -1)
@@ -243,14 +243,14 @@ class PluginManager():
def getPluginName(self, name):
""" used to obtain new name if other plugin was injected"""
plugin = None
- if self.containerPlugins.has_key(name):
+ if name in self.containerPlugins:
plugin = self.containerPlugins[name]
- if self.crypterPlugins.has_key(name):
+ if name in self.crypterPlugins:
plugin = self.crypterPlugins[name]
- if self.hosterPlugins.has_key(name):
+ if name in self.hosterPlugins:
plugin = self.hosterPlugins[name]
- if plugin.has_key("new_name"):
+ if "new_name" in plugin:
return plugin["new_name"]
return name
@@ -259,9 +259,9 @@ class PluginManager():
def getCaptchaPlugin(self, name):
"""return captcha modul if existent"""
- if self.captchaPlugins.has_key(name):
+ if name in self.captchaPlugins:
plugin = self.captchaPlugins[name]
- if plugin.has_key("class"):
+ if "class" in plugin:
return plugin["class"]
module = __import__(plugin["path"], globals(), locals(), [plugin["name"]], -1)
@@ -274,9 +274,9 @@ class PluginManager():
def getAccountPlugin(self, name):
"""return account class if existent"""
- if self.accountPlugins.has_key(name):
+ if name in self.accountPlugins:
plugin = self.accountPlugins[name]
- if plugin.has_key("class"):
+ if "class" in plugin:
return plugin["class"]
module = __import__(plugin["path"], globals(), locals(), [plugin["name"]], -1)
@@ -302,7 +302,7 @@ class PluginManager():
classes = []
for name, value in self.hookPlugins.iteritems():
- if value.has_key("class"):
+ if "class" in value:
classes.append(value["class"])
continue
diff --git a/module/plugins/crypter/SerienjunkiesOrg.py b/module/plugins/crypter/SerienjunkiesOrg.py
index 21afc88e8..5b6295fe7 100644
--- a/module/plugins/crypter/SerienjunkiesOrg.py
+++ b/module/plugins/crypter/SerienjunkiesOrg.py
@@ -72,7 +72,7 @@ class SerienjunkiesOrg(Crypter):
n = unescape(v.string)
n = n.strip()
n = re.sub(r"^([:]?)(.*?)([:]?)$", r'\2', n)
- if not opts.has_key(n.strip()):
+ if n.strip() not in opts:
continue
val = v.nextSibling
if not val:
@@ -99,7 +99,7 @@ class SerienjunkiesOrg(Crypter):
linkgroups = {}
for link in linklist:
key = re.sub("^http://download\.serienjunkies\.org/f-.*?/(.{2})_", "", link)
- if not linkgroups.has_key(key):
+ if key not in linkgroups:
linkgroups[key] = []
linkgroups[key].append(link)
for group in linkgroups.values():
diff --git a/module/plugins/hooks/CaptchaTrader.py b/module/plugins/hooks/CaptchaTrader.py
index c41ed9f97..a0e8a0453 100644
--- a/module/plugins/hooks/CaptchaTrader.py
+++ b/module/plugins/hooks/CaptchaTrader.py
@@ -132,12 +132,12 @@ class CaptchaTrader(Hook):
self.logInfo(_("Your CaptchaTrader Account has not enough credits"))
def captchaCorrect(self, task):
- if task.data.has_key("ticket"):
+ if "ticket" in task.data:
ticket = task.data["ticket"]
self.respond(ticket, True)
def captchaInvalid(self, task):
- if task.data.has_key("ticket"):
+ if "ticket" in task.data:
ticket = task.data["ticket"]
self.respond(ticket, False)
diff --git a/module/plugins/hooks/Ev0InFetcher.py b/module/plugins/hooks/Ev0InFetcher.py
index 5eb4e09c1..c7191cd4e 100644
--- a/module/plugins/hooks/Ev0InFetcher.py
+++ b/module/plugins/hooks/Ev0InFetcher.py
@@ -42,7 +42,7 @@ class Ev0InFetcher(Hook, PluginStorage):
sortedLinks = {}
for url, hoster in results:
- if not sortedLinks.has_key(hoster):
+ if hoster not in sortedLinks:
sortedLinks[hoster] = []
sortedLinks[hoster].append(url)
diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py
index dc7bd3b49..f15148538 100644
--- a/module/plugins/hooks/MultiHome.py
+++ b/module/plugins/hooks/MultiHome.py
@@ -71,7 +71,7 @@ class Interface(object):
self.history = {}
def lastPluginAccess(self, pluginName, account):
- if self.history.has_key((pluginName, account)):
+ if (pluginName, account) in self.history:
return self.history[(pluginName, account)]
return 0
diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py
index 2c8bf1259..59035926a 100644
--- a/module/plugins/hooks/RealdebridCom.py
+++ b/module/plugins/hooks/RealdebridCom.py
@@ -48,7 +48,7 @@ class RealdebridCom(Hook):
for hoster in self.getHostersCached():
name = removeChars(hoster.lower(), "-.")
- if pluginMap.has_key(name):
+ if name in pluginMap:
supported.append(pluginMap[name])
else:
new_supported.append(hoster)
diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py
index 324ef9b91..48b0fd826 100644
--- a/module/plugins/hooks/RehostTo.py
+++ b/module/plugins/hooks/RehostTo.py
@@ -60,7 +60,7 @@ class RehostTo(Hook):
for hoster in self.getHostersCached():
name = removeChars(hoster.lower(), "-.")
- if pluginMap.has_key(name):
+ if name in pluginMap:
supported.append(pluginMap[name])
else:
new_supported.append(hoster)
@@ -81,4 +81,4 @@ class RehostTo(Hook):
dict = self.core.pluginManager.hosterPlugins["RehostTo"]
dict["pattern"] = regexp
- dict["re"] = re.compile(regexp) \ No newline at end of file
+ dict["re"] = re.compile(regexp)
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index dc8eafbb8..7f4d57947 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -106,7 +106,7 @@ class UpdateManager(Hook):
plugins = getattr(self.core.pluginManager, "%sPlugins" % type)
- if plugins.has_key(tmp_name):
+ if tmp_name in plugins:
if float(plugins[tmp_name]["v"]) >= float(version):
continue
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index c698800ec..94f6e8320 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -42,7 +42,7 @@ def getAPIData(urls):
for line in api.splitlines():
data = line.split(",")
- if idMap.has_key(data[1]):
+ if data[1] in idMap:
result[data[1]] = (data[0], data[2], data[4], data[3], idMap[data[1]])
return result
@@ -94,7 +94,7 @@ class UploadedTo(Hoster):
api = getAPIData([pyfile.url])
- if not len(api) or not api.has_key(self.fileID):
+ if not len(api) or self.fileID not in api:
self.offline()
self.data = api[self.fileID]