summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-27 23:47:47 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-27 23:47:47 +0200
commit95ed76d34290e08876dccce6840c3e09138a2047 (patch)
treed48fd62290c2683575071884ca1ea1c4874e91f3 /module
parent[ExtractArchive] Rename archive_password.txt -> passwords.txt (diff)
downloadpyload-95ed76d34290e08876dccce6840c3e09138a2047.tar.xz
Spare code fixes
Diffstat (limited to 'module')
-rw-r--r--module/plugins/internal/DeadCrypter.py5
-rw-r--r--module/plugins/internal/DeadHoster.py5
-rw-r--r--module/plugins/internal/Hoster.py12
-rw-r--r--module/plugins/internal/MultiHoster.py10
-rw-r--r--module/plugins/internal/Plugin.py4
-rw-r--r--module/plugins/internal/SimpleHoster.py8
-rw-r--r--module/plugins/internal/UnRar.py4
-rw-r--r--module/plugins/internal/XFSAccount.py4
8 files changed, 26 insertions, 26 deletions
diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py
index 7d14f5378..e7cc6ff39 100644
--- a/module/plugins/internal/DeadCrypter.py
+++ b/module/plugins/internal/DeadCrypter.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Crypter import Crypter, create_getInfo
class DeadCrypter(Crypter):
__name__ = "DeadCrypter"
__type__ = "crypter"
- __version__ = "0.08"
+ __version__ = "0.09"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -24,8 +24,7 @@ class DeadCrypter(Crypter):
def setup(self):
- self.pyfile.error = "Crypter is no longer available"
- self.offline() #@TODO: self.offline("Crypter is no longer available")
+ self.offline(_("Crypter is no longer available"))
getInfo = create_getInfo(DeadCrypter)
diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py
index f8e68f2b3..250287d25 100644
--- a/module/plugins/internal/DeadHoster.py
+++ b/module/plugins/internal/DeadHoster.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Hoster import Hoster, create_getInfo
class DeadHoster(Hoster):
__name__ = "DeadHoster"
__type__ = "hoster"
- __version__ = "0.18"
+ __version__ = "0.19"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -24,8 +24,7 @@ class DeadHoster(Hoster):
def setup(self):
- self.pyfile.error = "Hoster is no longer available"
- self.offline() #@TODO: self.offline("Hoster is no longer available")
+ self.offline(_("Hoster is no longer available"))
getInfo = create_getInfo(DeadHoster)
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 8a11499fa..3d4c11af9 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -272,15 +272,17 @@ class Hoster(Plugin):
"""
Skip and give reason
"""
- raise Skip(encode(reason))
+ raise Skip(encode(reason)) #@TODO: Remove `encode` in 0.4.10
def abort(self, reason=""):
"""
Abort and give reason
"""
+ #@TODO: Remove in 0.4.10
if reason:
self.pyfile.error = encode(reason)
+
raise Abort
@@ -288,8 +290,10 @@ class Hoster(Plugin):
"""
Fail and indicate file is offline
"""
+ #@TODO: Remove in 0.4.10
if reason:
self.pyfile.error = encode(reason)
+
raise Fail("offline")
@@ -297,8 +301,10 @@ class Hoster(Plugin):
"""
Fail and indicates file ist temporary offline, the core may take consequences
"""
+ #@TODO: Remove in 0.4.10
if reason:
self.pyfile.error = encode(reason)
+
raise Fail("temp. offline")
@@ -320,7 +326,7 @@ class Hoster(Plugin):
self.wait(wait_time, False)
self.retries[id] += 1
- raise Retry(reason)
+ raise Retry(encode(reason)) #@TODO: Remove `encode` in 0.4.10
def restart(self, reason=None, reset=False):
@@ -335,7 +341,7 @@ class Hoster(Plugin):
self.account = None
self.req = self.pyload.requestFactory.getRequest(self.__name__)
- raise Retry(reason)
+ raise Retry(encode(reason)) #@TODO: Remove `encode` in 0.4.10
def fixurl(self, url):
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 5058cf515..e32c3cdc5 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -2,7 +2,7 @@
import re
-from module.plugins.internal.Plugin import Fail, Retry
+from module.plugins.internal.Plugin import Fail
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies
@@ -85,11 +85,9 @@ class MultiHoster(SimpleHoster):
self.check_file()
except Fail, e: #@TODO: Move to PluginThread in 0.4.10
- err = str(e) #@TODO: Recheck in 0.4.10
-
if self.premium:
self.log_warning(_("Premium download failed"))
- self.retry_free()
+ self.restart(reset=True)
elif self.get_config("revertfailed", True) \
and "new_module" in self.pyload.pluginManager.hosterPlugins[self.__name__]:
@@ -105,10 +103,10 @@ class MultiHoster(SimpleHoster):
hdict['new_module'] = tmp_module
hdict['new_name'] = tmp_name
- raise Retry(_("Revert to original hoster plugin"))
+ self.restart(_("Revert to original hoster plugin"))
else:
- raise Fail(err)
+ raise Fail(encode(e)) #@TODO: Remove `encode` in 0.4.10
def handle_premium(self, pyfile):
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index e781ca297..52c22b527 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -245,7 +245,7 @@ class Plugin(object):
"""
Fail and give reason
"""
- raise Fail(encode(reason)) #: Move `encode(reason)` to manager in 0.4.10
+ raise Fail(encode(reason)) #@TODO: Remove `encode` in 0.4.10
def error(self, reason="", type=_("Parse")):
@@ -256,7 +256,7 @@ class Plugin(object):
msg += (": %s" % reason.strip()) if reason else ""
msg += _(" | Plugin may be out of date")
- raise Fail(msg)
+ raise Fail(encode(msg)) #@TODO: Remove `encode` in 0.4.10
def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=True, req=None):
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index a80bc94cb..936887342 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -13,7 +13,7 @@ from module.PyFile import statusMap as _statusMap
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.Hoster import Hoster, create_getInfo, parse_fileInfo
-from module.plugins.internal.Plugin import Fail, Retry, fixurl, replace_patterns, seconds_to_midnight, set_cookies
+from module.plugins.internal.Plugin import Fail, encode, fixurl, replace_patterns, seconds_to_midnight, set_cookies
from module.utils import fixup, fs_encode, parseFileSize as parse_size
@@ -211,7 +211,7 @@ class SimpleHoster(Hoster):
self.leech_dl = False
if not self.get_config('use_premium', True):
- self.retry_free()
+ self.restart(reset=True)
if self.LOGIN_PREMIUM and not self.premium:
self.fail(_("Required premium account not found"))
@@ -299,14 +299,12 @@ class SimpleHoster(Hoster):
self.check_file()
except Fail, e: #@TODO: Move to PluginThread in 0.4.10
- err = str(e) #@TODO: Recheck in 0.4.10
-
if self.get_config('fallback', True) and self.premium:
self.log_warning(_("Premium download failed"), e)
self.restart(reset=True)
else:
- raise Fail(err)
+ raise Fail(encode(e)) #@TODO: Remove `encode` in 0.4.10
def check_file(self):
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index a2c2070b8..30b763922 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
- __version__ = "1.22"
+ __version__ = "1.23"
__status__ = "testing"
__description__ = """Rar extractor plugin"""
@@ -65,7 +65,7 @@ class UnRar(Extractor):
try:
if os.name == "nt":
cls.CMD = os.path.join(pypath, "UnRAR.exe")
- else:
+ else:
cls.CMD = "unrar"
p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py
index 6d6cc97e7..93a04dc86 100644
--- a/module/plugins/internal/XFSAccount.py
+++ b/module/plugins/internal/XFSAccount.py
@@ -151,8 +151,8 @@ class XFSAccount(Account):
def login(self, user, password, data, req):
- if not self.HOSTER_URL: #@TODO: Remove in 0.4.10
- raise Exception(_("Missing HOSTER_DOMAIN"))
+ if not self.HOSTER_URL:
+ self.login_fail(_("Missing HOSTER_DOMAIN"))
if not self.LOGIN_URL:
self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html")