summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-28 23:46:24 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-28 23:46:24 +0100
commit58878a455067837dbe72c690606157831d3afae1 (patch)
treeac59fe8fa23a2531f7fdf03341ed1eff0326f67f
parentSpare code fixes (2) (diff)
downloadpyload-58878a455067837dbe72c690606157831d3afae1.tar.xz
Spare code fixes (3)
-rw-r--r--module/plugins/hooks/AntiVirus.py2
-rw-r--r--module/plugins/hooks/Checksum.py12
-rw-r--r--module/plugins/hooks/ExtractArchive.py8
-rw-r--r--module/plugins/hooks/SkipRev.py37
-rw-r--r--module/plugins/hooks/UnSkipOnFail.py26
-rw-r--r--module/plugins/hooks/XFileSharing.py8
-rw-r--r--module/plugins/hoster/GoogledriveCom.py17
-rw-r--r--module/plugins/hoster/UploadingCom.py4
-rw-r--r--module/plugins/internal/Account.py1
-rw-r--r--module/plugins/internal/Base.py6
-rw-r--r--module/plugins/internal/Hoster.py12
-rw-r--r--module/plugins/internal/Plugin.py2
-rw-r--r--module/plugins/internal/SimpleCrypter.py2
13 files changed, 72 insertions, 65 deletions
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index 55b883684..1a0f3f8bd 100644
--- a/module/plugins/hooks/AntiVirus.py
+++ b/module/plugins/hooks/AntiVirus.py
@@ -17,7 +17,7 @@ class AntiVirus(Addon):
__name__ = "AntiVirus"
__type__ = "hook"
__version__ = "0.16"
- __status__ = "testing"
+ __status__ = "broken"
#@TODO: add trash option (use Send2Trash lib)
__config__ = [("activated" , "bool" , "Activated" , False ),
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index 28fdeafee..af6f2f406 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -39,7 +39,7 @@ class Checksum(Addon):
__name__ = "Checksum"
__type__ = "hook"
__version__ = "0.24"
- __status__ = "testing"
+ __status__ = "broken"
__config__ = [("activated" , "bool" , "Activated" , False ),
("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ),
@@ -168,15 +168,15 @@ class Checksum(Addon):
def package_finished(self, pypack):
dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pypack.folder, "")
- for link in pypack.getChildren().values():
- file_type = os.path.splitext(link['name'])[1][1:].lower()
+ for fid, fdata in pypack.getChildren().items():
+ file_type = os.path.splitext(fdata['name'])[1][1:].lower()
if file_type not in self.formats:
continue
- hash_file = encode(fsjoin(dl_folder, link['name']))
+ hash_file = encode(fsjoin(dl_folder, fdata['name']))
if not os.path.isfile(hash_file):
- self.log_warning(_("File not found"), link['name'])
+ self.log_warning(_("File not found"), fdata['name'])
continue
with open(hash_file) as f:
@@ -184,7 +184,7 @@ class Checksum(Addon):
for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text):
data = m.groupdict()
- self.log_debug(link['name'], data)
+ self.log_debug(fdata['name'], data)
local_file = encode(fsjoin(dl_folder, data['NAME']))
algorithm = self.methods.get(file_type, file_type)
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 96c8d7ed3..a60205f20 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -99,7 +99,7 @@ class ExtractArchive(Addon):
__name__ = "ExtractArchive"
__type__ = "hook"
__version__ = "1.54"
- __status__ = "testing"
+ __status__ = "broken"
__config__ = [("activated" , "bool" , "Activated" , True ),
("fullpath" , "bool" , "Extract with full paths" , True ),
@@ -142,7 +142,7 @@ class ExtractArchive(Addon):
def activate(self):
- for p in ("UnRar", "SevenZip", "UnZip"):
+ for p in ("UnRar", "SevenZip", "UnZip", "UnTar"):
try:
module = self.pyload.pluginManager.loadModule("internal", p)
klass = getattr(module, p)
@@ -277,8 +277,8 @@ class ExtractArchive(Addon):
matched = False
success = True
- files_ids = dict((pylink['name'], ((fsjoin(dl_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \
- in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).values() #: Remove duplicates
+ files_ids = dict((fdata['name'], ((fsjoin(dl_folder, pypack.folder, fdata['name'])), fid, out)) for fid, fdata \
+ in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).items() #: Remove duplicates
#: Check as long there are unseen files
while files_ids:
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index 9b47c2081..429737e94 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -25,17 +25,18 @@ class SkipRev(Addon):
return pyfile.pluginclass.get_info(pyfile.url)['name']
- def create_pyFile(self, link):
+ def _create_pyFile(self, data):
+ pylink = self.pyload.api._convertPyFile(data)
return PyFile(self.pyload.files,
- link.fid,
- link.url,
- link.name,
- link.size,
- link.status,
- link.error,
- link.plugin,
- link.packageID,
- link.order)
+ pylink.fid,
+ pylink.url,
+ pylink.name,
+ pylink.size,
+ pylink.status,
+ pylink.error,
+ pylink.plugin,
+ pylink.packageID,
+ pylink.order)
def download_preparing(self, pyfile):
@@ -50,8 +51,8 @@ class SkipRev(Addon):
status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14)
pyname = re.compile(r'%s\.part\d+\.rev$' % name.rsplit('.', 2)[0].replace('.', '\.'))
- queued = [True for link in pyfile.package().getChildren() \
- if link.status not in status_list and pyname.match(link.name)].count(True)
+ queued = [True for fid, fdata in pyfile.package().getChildren().items() \
+ if fdata['status'] not in status_list and pyname.match(fdata['name'])].count(True)
if not queued or queued < revtokeep: #: Keep one rev at least in auto mode
return
@@ -70,15 +71,15 @@ class SkipRev(Addon):
pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.'))
- for link in pyfile.package().getChildren():
- if link.status is 4 and pyname.match(link.name):
- pylink = self.create_pyFile(link)
+ for fid, fdata in pyfile.package().getChildren().items():
+ if fdata['status'] is 4 and pyname.match(fdata['name']):
+ pyfile_new = self._create_pyFile(fdata)
if revtokeep > -1 or pyfile.name.endswith(".rev"):
- pylink.setStatus("queued")
+ pyfile_new.setStatus("queued")
else:
- pylink.setCustomStatus(_("unskipped"), "queued")
+ pyfile_new.setCustomStatus(_("unskipped"), "queued")
self.pyload.files.save()
- pylink.release()
+ pyfile_new.release()
return
diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py
index d51030b01..db43bca2b 100644
--- a/module/plugins/hooks/UnSkipOnFail.py
+++ b/module/plugins/hooks/UnSkipOnFail.py
@@ -32,12 +32,12 @@ class UnSkipOnFail(Addon):
#: It creates a temporary PyFile object using
#: "link" data, changes its status, and tells
#: The pyload.files-manager to save its data.
- pylink = self.create_pyFile(link)
+ pyfile_new = self._create_pyFile(link)
- pylink.setCustomStatus(_("unskipped"), "queued")
+ pyfile_new.setCustomStatus(_("unskipped"), "queued")
self.pyload.files.save()
- pylink.release()
+ pyfile_new.release()
else:
self.log_info(_("No duplicates found"))
@@ -71,14 +71,14 @@ class UnSkipOnFail(Addon):
return link
- def create_pyFile(self, link):
+ def _create_pyFile(self, pylink):
return PyFile(self.pyload.files,
- link.fid,
- link.url,
- link.name,
- link.size,
- link.status,
- link.error,
- link.plugin,
- link.packageID,
- link.order)
+ pylink.fid,
+ pylink.url,
+ pylink.name,
+ pylink.size,
+ pylink.status,
+ pylink.error,
+ pylink.plugin,
+ pylink.packageID,
+ pylink.order)
diff --git a/module/plugins/hooks/XFileSharing.py b/module/plugins/hooks/XFileSharing.py
index 201cbab53..4af246da8 100644
--- a/module/plugins/hooks/XFileSharing.py
+++ b/module/plugins/hooks/XFileSharing.py
@@ -9,10 +9,10 @@ from module.plugins.internal.Addon import Addon
class XFileSharing(Addon):
__name__ = "XFileSharing"
__type__ = "hook"
- __version__ = "0.54"
+ __version__ = "0.55"
__status__ = "testing"
- __config__ = [("activated" , "bool", "Activated" , True ),
+ __config__ = [("activated" , "bool", "Activated" , False),
("use_hoster_list" , "bool", "Load listed hosters only" , False),
("use_crypter_list", "bool", "Load listed crypters only" , False),
("use_builtin_list", "bool", "Load built-in plugin list" , True ),
@@ -107,7 +107,7 @@ class XFileSharing(Addon):
else:
pattern = self.regexp[type][0]
- self.log_info(_("Handle any %s site on the web!") % type)
+ self.log_info(_("Auto-discover new %ss") % type)
return pattern
@@ -122,7 +122,7 @@ class XFileSharing(Addon):
dict['pattern'] = pattern
dict['re'] = re.compile(pattern)
- self.log_debug("Loaded %s pattern: %s" % (type, pattern))
+ self.log_debug("Pattern for %ss: %s" % (type, pattern))
def _unload(self, type, plugin):
diff --git a/module/plugins/hoster/GoogledriveCom.py b/module/plugins/hoster/GoogledriveCom.py
index ad41ef040..3090d5f85 100644
--- a/module/plugins/hoster/GoogledriveCom.py
+++ b/module/plugins/hoster/GoogledriveCom.py
@@ -13,7 +13,7 @@ from module.plugins.internal.misc import html_unescape
class GoogledriveCom(SimpleHoster):
__name__ = "GoogledriveCom"
__type__ = "hoster"
- __version__ = "0.18"
+ __version__ = "0.20"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?(drive|docs)\.google\.com/(file/d/\w+|uc\?.*id=)'
@@ -35,7 +35,7 @@ class GoogledriveCom(SimpleHoster):
def setup(self):
- self.multiDL = True
+ self.multiDL = True
self.resume_download = True
self.chunk_limit = 1
@@ -47,11 +47,12 @@ class GoogledriveCom(SimpleHoster):
if m is None:
return
- link = self.fixurl(link, "https://docs.google.com/")
- dl = self.isdownload(link, redirect=False)
+ link = self.fixurl(m.group(1), "https://docs.google.com/")
+ dl = self.isdownload(link)
- if not dl:
- self.data = self.load(link)
- else:
+ if dl:
self.link = dl
- break
+ return
+ else:
+ self.data = self.load(link)
+ \ No newline at end of file
diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py
index d8447e964..d85e02eaf 100644
--- a/module/plugins/hoster/UploadingCom.py
+++ b/module/plugins/hoster/UploadingCom.py
@@ -11,8 +11,8 @@ from module.plugins.internal.misc import encode, json, timestamp
class UploadingCom(SimpleHoster):
__name__ = "UploadingCom"
__type__ = "hoster"
- __version__ = "0.47"
- __status__ = "testing"
+ __version__ = "0.48"
+ __status__ = "broken"
__pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)'
__config__ = [("activated" , "bool", "Activated" , True),
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index ec226956f..c63d182d9 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -68,6 +68,7 @@ class Account(Plugin):
log = getattr(self.pyload.log, level)
msg = u" | ".join(decode(a).strip() for a in messages if a)
+ #: Hide any password
try:
msg = msg.replace(self.info['login']['password'], "**********")
except Exception:
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py
index 3d0bed791..47111ca8e 100644
--- a/module/plugins/internal/Base.py
+++ b/module/plugins/internal/Base.py
@@ -105,6 +105,7 @@ class Base(Plugin):
log = getattr(self.pyload.log, level)
msg = u" | ".join(decode(a).strip() for a in messages if a)
+ #: Hide any password
try:
msg = msg.replace(self.account.info['login']['password'], "**********")
except Exception:
@@ -253,7 +254,7 @@ class Base(Plugin):
self.log_debug("Plugin status: " + self.__status__)
if self.__status__ is "broken":
- self.fail(_("Plugin is temporarily unavailable"))
+ self.abort(_("Plugin is temporarily unavailable"))
elif self.__status__ is "testing":
self.log_warning(_("Plugin may be unstable"))
@@ -268,7 +269,8 @@ class Base(Plugin):
self._initialize()
self._setup()
- # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10
+ #@TODO: Enable in 0.4.10
+ # self.pyload.hookManager.downloadPreparing(self.pyfile)
# self.check_status()
self.pyfile.setStatus("starting")
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 2e70517d3..6d88732ea 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -88,7 +88,8 @@ class Hoster(Base):
self._initialize()
self._setup()
- # self.pyload.hookManager.downloadPreparing(self.pyfile) #@TODO: Recheck in 0.4.10
+ #@TODO: Enable in 0.4.10
+ # self.pyload.hookManager.downloadPreparing(self.pyfile)
# self.check_status()
self.check_duplicates()
@@ -120,14 +121,15 @@ class Hoster(Base):
self.pyload.hookManager.dispatchEvent("download_processed", self.pyfile)
try:
- unfinished = any(pyfile.hasStatus('queued') for pyfile in pypack.getChildren()
- if pyfile.id is not self.pyfile.id)
+ unfinished = any(fdata['status'] is 3 for fid, fdata in pypack.getChildren().items()
+ if fid is not self.pyfile.id)
if unfinished:
return
self.pyload.hookManager.dispatchEvent("package_processed", pypack)
- failed = any(pyfile.status in (1, 6, 8, 9, 14) for pyfile in pypack.getChildren())
+ failed = any(fdata['status'] in (1, 6, 8, 9, 14)
+ for fid, fdata in pypack.getChildren().items())
if not failed:
return
@@ -149,7 +151,7 @@ class Hoster(Base):
maxredirs = max(redirect, 1)
elif redirect:
- maxredirs = self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin") or maxredirs
+ maxredirs = int(self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin")) or maxredirs #@TODO: Remove `int` in 0.4.10
for i in xrange(maxredirs):
self.log_debug("Redirect #%d to: %s" % (i, url))
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 79370a975..71137e496 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -206,7 +206,7 @@ class Plugin(object):
req.http.c.setopt(pycurl.FOLLOWLOCATION, 1)
elif type(redirect) is int:
- maxredirs = self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin") or 5
+ maxredirs = int(self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin")) or 5 #@TODO: Remove `int` in 0.4.10
req.http.c.setopt(pycurl.MAXREDIRS, maxredirs)
#@TODO: Move to network in 0.4.10
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index b98ac4d76..97d7a660a 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -148,7 +148,7 @@ class SimpleCrypter(Crypter):
def handle_direct(self, pyfile):
- maxredirs = self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin") or 5
+ maxredirs = int(self.pyload.api.getConfigValue("UserAgentSwitcher", "maxredirs", "plugin")) or 5 #@TODO: Remove `int` in 0.4.10
redirect = None
for i in xrange(maxredirs):