diff options
Diffstat (limited to 'module/plugins/hooks')
42 files changed, 241 insertions, 885 deletions
diff --git a/module/plugins/hooks/AlldebridComHook.py b/module/plugins/hooks/AlldebridComHook.py deleted file mode 100644 index 402850d87..000000000 --- a/module/plugins/hooks/AlldebridComHook.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class AlldebridComHook(MultiHook): - __name__ = "AlldebridComHook" - __type__ = "hook" - __version__ = "0.17" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Alldebrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "spamsales@online.de")] - - - def get_hosters(self): - html = self.load("https://www.alldebrid.com/api.php", - get={'action': "get_host"}).replace("\"", "").strip() - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py index 48b86fa55..fbb7f6760 100644 --- a/module/plugins/hooks/AntiStandby.py +++ b/module/plugins/hooks/AntiStandby.py @@ -59,7 +59,7 @@ class AntiStandby(Addon): self.interval = max(self.get_config('interval'), self.MIN_INTERVAL) self.init_periodical(threaded=True) - if os.name == "nt": + if os.name is "nt": self.win_standby(system, display) elif sys.platform == "darwin": @@ -76,7 +76,7 @@ class AntiStandby(Addon): except OSError: pass - if os.name == "nt": + if os.name is "nt": self.win_standby(True) elif sys.platform == "darwin": diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py index b58d0b61d..d7ec69031 100644 --- a/module/plugins/hooks/AntiVirus.py +++ b/module/plugins/hooks/AntiVirus.py @@ -10,23 +10,25 @@ except ImportError: pass from module.plugins.internal.Addon import Addon, Expose, threaded +from module.plugins.internal.Plugin import exists from module.utils import fs_encode, save_join as fs_join class AntiVirus(Addon): __name__ = "AntiVirus" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" #@TODO: add trash option (use Send2Trash lib) - __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), - ("quardir" , "folder" , "Quarantine folder" , "" ), - ("deltotrash", "bool" , "Move to trash (recycle bin) instead delete", True ), - ("scanfailed", "bool" , "Scan incompleted files (failed downloads)" , False ), - ("cmdfile" , "file" , "Antivirus executable" , "" ), - ("cmdargs" , "str" , "Scan options" , "" ), - ("ignore-err", "bool" , "Ignore scan errors" , False )] + __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), + ("quardir" , "folder" , "Quarantine folder" , "" ), + ("deltotrash", "bool" , "Move to trash instead delete", True ), + ("scanfailed", "bool" , "Scan failed downloads" , False ), + ("avfile" , "file" , "Antivirus executable" , "" ), + ("avargs" , "str" , "Executable arguments" , "" ), + ("avtarget" , "file;folder" , "Scan target" , "file" ), + ("ignore-err", "bool" , "Ignore scan errors" , False )] __description__ = """Scan downloaded files with antivirus program""" __license__ = "GPLv3" @@ -36,12 +38,24 @@ class AntiVirus(Addon): @Expose @threaded def scan(self, pyfile, thread): - file = fs_encode(pyfile.plugin.last_download) - filename = os.path.basename(pyfile.plugin.last_download) - cmdfile = fs_encode(self.get_config('cmdfile')) - cmdargs = fs_encode(self.get_config('cmdargs').strip()) + avfile = fs_encode(self.get_config('avfile')) + avargs = fs_encode(self.get_config('avargs').strip()) - if not os.path.isfile(file) or not os.path.isfile(cmdfile): + if not os.path.isfile(avfile): + self.fail(_("Antivirus executable not found")) + + scanfolder = self.get_config('avtarget') is "folder" + + if scanfolder: + download_folder = self.pyload.config.get("general", "download_folder") + package_folder = pyfile.package().folder if self.pyload.config.get("general", "folder_per_package") else "" + target = fs_join(download_folder, package_folder, pyfile.name) + target_repr = "Folder: " + package_folder or download_folder + else: + target = fs_encode(pyfile.plugin.last_download) + target_repr = "File: " + os.path.basename(pyfile.plugin.last_download) + + if not exists(target): return thread.addActive(pyfile) @@ -49,24 +63,34 @@ class AntiVirus(Addon): pyfile.setProgress(0) try: - p = subprocess.Popen([cmdfile, cmdargs, file], bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen([avfile, avargs, target], + bufsize=-1, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) out, err = map(str.strip, p.communicate()) if out: - self.log_info(filename, out) + self.log_info(target_repr, out) if err: - self.log_warning(filename, err) + self.log_warning(target_repr, err) if not self.get_config('ignore-err'): - self.log_debug("Delete/Quarantine task is aborted") + self.log_debug("Delete/Quarantine task aborted due scan error") return if p.returncode: - pyfile.error = _("Infected file") action = self.get_config('action') + + if scanfolder: + if action is "Antivirus default": + self.log_warning(_("Delete/Quarantine task skipped in folder scan mode") + return + + pyfile.error = _("Infected file") + try: - if action == "Delete": + if action is "Delete": if not self.get_config('deltotrash'): os.remove(file) @@ -87,15 +111,15 @@ class AntiVirus(Addon): else: self.log_debug("Successfully moved file to trash") - elif action == "Quarantine": + elif action is "Quarantine": pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.get_config('quardir')) except (IOError, shutil.Error), e: - self.log_error(filename, action + " action failed!", e) + self.log_error(target_repr, action + " action failed!", e) - elif not out and not err: - self.log_debug(filename, "No infected file found") + elif not err: + self.log_debug(target_repr, "No infected file found") finally: pyfile.setProgress(100) @@ -108,5 +132,5 @@ class AntiVirus(Addon): def download_failed(self, pyfile): #: Check if pyfile is still "failed", maybe might has been restarted in meantime - if pyfile.status == 8 and self.get_config('scanfailed'): + if pyfile.status is 8 and self.get_config('scanfailed'): return self.scan(pyfile) diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index 2e2685978..656497dd6 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -78,7 +78,6 @@ class Captcha9Kw(Hook): 'cpm' : self.get_config('captchapermin')} for opt in str(self.get_config('hoster_options').split('|')): - details = map(str.strip, opt.split(':')) if not details or details[0].lower() is not pluginname.lower(): @@ -149,6 +148,7 @@ class Captcha9Kw(Hook): time.sleep(5) else: break + else: self.log_debug("Could not send request: %s" % res) result = None @@ -184,6 +184,7 @@ class Captcha9Kw(Hook): break time.sleep(10) + else: self.fail(_("Too many captchas in queue")) @@ -196,9 +197,9 @@ class Captcha9Kw(Hook): for d in details: hosteroption = d.split("=") - if len(hosteroption) > 1 \ - and hosteroption[0].lower() == "timeout" \ - and hosteroption[1].isdigit(): + if len(hosteroption) > 1 and \ + hosteroption[0].lower() == "timeout" and \ + hosteroption[1].isdigit(): timeout = int(hosteroption[1]) break diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 0df1ab8a9..838c220f0 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -79,6 +79,7 @@ class CaptchaBrotherhood(Hook): img.save(output, "JPEG") data = output.getvalue() output.close() + except Exception, e: raise CaptchaBrotherhoodException("Reading or converting captcha image failed: %s" % e) @@ -98,6 +99,7 @@ class CaptchaBrotherhood(Hook): try: req.c.perform() res = req.getResponse() + except Exception, e: raise CaptchaBrotherhoodException("Submit captcha image failed") diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 6ecbfcda2..2a650768e 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -38,7 +38,7 @@ def compute_checksum(local_file, algorithm): class Checksum(Addon): __name__ = "Checksum" __type__ = "hook" - __version__ = "0.19" + __version__ = "0.22" __status__ = "testing" __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), @@ -114,7 +114,7 @@ class Checksum(Addon): api_size = int(data['size']) file_size = os.path.getsize(local_file) - if api_size is not file_size: + if api_size != file_size: self.log_warning(_("File %s has incorrect size: %d B (%d expected)") % (pyfile.name, file_size, api_size)) self.check_failed(pyfile, local_file, "Incorrect file size") @@ -131,15 +131,15 @@ class Checksum(Addon): for key in self.algorithms: if key in data: - checksum = computeChecksum(local_file, key.replace("-", "").lower()) + checksum = compute_checksum(local_file, key.replace("-", "").lower()) if checksum: - if checksum is data[key].lower(): + if checksum == data[key].lower(): self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (pyfile.name, key.upper(), checksum)) break else: self.log_warning(_("%s checksum for file %s does not match (%s != %s)") % - (key.upper(), pyfile.name, checksum, data[key])) + (key.upper(), pyfile.name, checksum, data[key].lower())) self.check_failed(pyfile, local_file, "Checksums do not match") else: self.log_warning(_("Unsupported hashing algorithm"), key.upper()) @@ -160,7 +160,7 @@ class Checksum(Addon): return elif check_action == "nothing": return - pyfile.plugin.fail(reason=msg) + pyfile.plugin.fail(msg=msg) def package_finished(self, pypack): @@ -186,7 +186,7 @@ class Checksum(Addon): local_file = fs_encode(fs_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) - checksum = computeChecksum(local_file, algorithm) + checksum = compute_checksum(local_file, algorithm) if checksum is data['HASH']: self.log_info(_('File integrity of "%s" verified by %s checksum (%s)') % (data['NAME'], algorithm, checksum)) diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index ba03129e6..591be8b59 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -84,7 +84,7 @@ class ClickAndLoad(Addon): server_socket = ssl.wrap_socket(server_socket) except NameError: - self.log_error(_("pyLoad's webinterface is configured to use HTTPS, Please install python's ssl lib or disable HTTPS")) + self.log_error(_("Missing SSL lib"), _("Please disable HTTPS in pyLoad settings")) client_socket.close() #: Reset the connection. continue diff --git a/module/plugins/hooks/DebridItaliaComHook.py b/module/plugins/hooks/DebridItaliaComHook.py deleted file mode 100644 index 1b000c665..000000000 --- a/module/plugins/hooks/DebridItaliaComHook.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class DebridItaliaComHook(MultiHook): - __name__ = "DebridItaliaComHook" - __type__ = "hook" - __version__ = "0.13" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Debriditalia.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell" , "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com" )] - - - def get_hosters(self): - return self.load("http://debriditalia.com/api.php", get={'hosts': ""}).replace('"', '').split(',') diff --git a/module/plugins/hooks/EasybytezComHook.py b/module/plugins/hooks/EasybytezComHook.py deleted file mode 100644 index 6f53619ac..000000000 --- a/module/plugins/hooks/EasybytezComHook.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class EasybytezComHook(MultiHook): - __name__ = "EasybytezComHook" - __type__ = "hook" - __version__ = "0.08" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """EasyBytez.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def get_hosters(self): - user, info = self.account.select() - - html = self.load("http://www.easybytez.com", - req=self.account.get_request(user)) - - return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',') diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index b7495136a..c752ce6ac 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -3,6 +3,7 @@ import os import subprocess +from module.plugins.internal.Plugin import encode from module.plugins.internal.Addon import Addon, Expose from module.utils import fs_encode, save_join as fs_join @@ -10,7 +11,7 @@ from module.utils import fs_encode, save_join as fs_join class ExternalScripts(Addon): __name__ = "ExternalScripts" __type__ = "hook" - __version__ = "0.46" + __version__ = "0.47" __status__ = "testing" __config__ = [("activated", "bool", "Activated" , True ), @@ -66,7 +67,8 @@ class ExternalScripts(Addon): self.log_debug(e) return - for file in os.listdir(path): + for filename in os.listdir(path): + file = fs_join(path, filename) if not os.path.isfile(file): continue @@ -77,13 +79,14 @@ class ExternalScripts(Addon): self.log_warning(_("Script not executable: [%s] %s") % (name, file)) self.scripts[name].append(file) + self.log_info(_("Registered script: [%s] %s") % (name, file)) @Expose def call(self, script, args=[], lock=False): try: script = os.path.abspath(script) - args = [script] + map(encode, args) + args = [script] + map(lambda arg: encode(arg) if isinstance(arg, basestring) else encode(str(arg)), args) self.log_info(_("EXECUTE [%s] %s") % (os.path.dirname(script), args)) p = subprocess.Popen(args, bufsize=-1) #@NOTE: output goes to pyload @@ -91,7 +94,8 @@ class ExternalScripts(Addon): p.communicate() except Exception, e: - self.log_error(_("Runtime error: %s") % script, e or _("Unknown error")) + self.log_error(_("Runtime error: %s") % script, + e or _("Unknown error")) def pyload_start(self): diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index eab196160..9c662a897 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -4,11 +4,10 @@ from __future__ import with_statement import os import sys -import traceback # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 -if sys.version_info < (2, 7) and os.name != "nt": +if sys.version_info < (2, 7) and os.name is not "nt": import errno import subprocess @@ -51,7 +50,7 @@ except ImportError: pass from module.plugins.internal.Addon import Addon, Expose, threaded -from module.plugins.internal.Plugin import replace_patterns +from module.plugins.internal.Plugin import exists, replace_patterns from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError from module.utils import fs_encode, save_join as fs_join, uniqify @@ -66,6 +65,7 @@ class ArchiveQueue(object): def get(self): try: return [int(pid) for pid in self.plugin.retrieve("ExtractArchive:%s" % self.storage, "").decode('base64').split()] + except Exception: return [] @@ -107,26 +107,25 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.49" + __version__ = "1.51" __status__ = "testing" - __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" , "passwords.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 )] + __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 ), + ("usepasswordfile", "bool" , "Use password file" , True ), + ("passwordfile" , "file" , "Password file" , "passwords.txt" ), + ("delete" , "bool" , "Delete archive after extraction" , True ), + ("deltotrash" , "bool" , "Move to trash 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" @@ -167,13 +166,9 @@ class ExtractArchive(Addon): self.log_warning(_("No %s installed") % p) else: self.log_warning(_("Could not activate: %s") % p, e) - if self.pyload.debug: - traceback.print_exc() except Exception, e: self.log_warning(_("Could not activate: %s") % p, e) - if self.pyload.debug: - traceback.print_exc() if self.extractors: self.log_debug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors]) @@ -288,7 +283,7 @@ class ExtractArchive(Addon): if subfolder: out = fs_join(out, pypack.folder) - if not os.path.exists(out): + if not exists(out): os.makedirs(out) matched = False @@ -313,7 +308,7 @@ class ExtractArchive(Addon): for fname, fid, fout in targets: name = os.path.basename(fname) - if not os.path.exists(fname): + if not exists(fname): self.log_debug(name, "File not found") continue @@ -348,7 +343,7 @@ class ExtractArchive(Addon): #: 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.get_delete_files()] + if fname not in archive.items()] self.log_debug("Extracted files: %s" % new_files) for file in new_files: @@ -356,7 +351,7 @@ class ExtractArchive(Addon): for filename in new_files: file = fs_encode(fs_join(os.path.dirname(archive.filename), filename)) - if not os.path.exists(file): + if not exists(file): self.log_debug("New file %s does not exists" % filename) continue @@ -403,18 +398,10 @@ class ExtractArchive(Addon): passwords = uniqify([password] + self.get_passwords(False)) if self.get_config('usepasswordfile') else [password] for pw in passwords: try: - if self.get_config('test') or self.repair: - pyfile.setCustomStatus(_("archive testing")) - if pw: - self.log_debug("Testing with password: %s" % pw) - pyfile.setProgress(0) - archive.verify(pw) - pyfile.setProgress(100) - else: - archive.check(pw) - - self.add_password(pw) - break + pyfile.setCustomStatus(_("archive testing")) + pyfile.setProgress(0) + archive.verify(pw) + pyfile.setProgress(100) except PasswordError: if not encrypted: @@ -425,9 +412,11 @@ class ExtractArchive(Addon): self.log_debug(name, e) self.log_info(name, _("CRC Error")) - if self.repair: - self.log_warning(name, _("Repairing...")) + if not self.repair: + raise CRCError("Archive damaged") + else: + self.log_warning(name, _("Repairing...")) pyfile.setCustomStatus(_("archive repairing")) pyfile.setProgress(0) repaired = archive.repair() @@ -436,15 +425,18 @@ class ExtractArchive(Addon): if not repaired and not self.get_config('keepbroken'): raise CRCError("Archive damaged") - self.add_password(pw) - break - - raise CRCError("Archive damaged") + else: + self.add_password(pw) + break except ArchiveError, e: raise ArchiveError(e) - pyfile.setCustomStatus(_("extracting")) + else: + self.add_password(pw) + break + + pyfile.setCustomStatus(_("archive extracting")) pyfile.setProgress(0) if not encrypted or not self.get_config('usepasswordfile'): @@ -467,7 +459,7 @@ class ExtractArchive(Addon): pyfile.setProgress(100) pyfile.setStatus("processing") - delfiles = archive.get_delete_files() + delfiles = archive.items() self.log_debug("Would delete: " + ", ".join(delfiles)) if self.get_config('delete'): @@ -476,7 +468,7 @@ class ExtractArchive(Addon): deltotrash = self.get_config('deltotrash') for f in delfiles: file = fs_encode(f) - if not os.path.exists(file): + if not exists(file): continue if not deltotrash: @@ -513,8 +505,6 @@ class ExtractArchive(Addon): except Exception, e: self.log_error(name, _("Unknown error"), e) - if self.pyload.debug: - traceback.print_exc() self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) diff --git a/module/plugins/hooks/FastixRuHook.py b/module/plugins/hooks/FastixRuHook.py deleted file mode 100644 index 3fdb29409..000000000 --- a/module/plugins/hooks/FastixRuHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class FastixRuHook(MultiHook): - __name__ = "FastixRuHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Fastix.ru hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] - - - def get_hosters(self): - html = self.load("http://fastix.ru/api_v2", - get={'apikey': "5182964c3f8f9a7f0b00000a_kelmFB4n1IrnCDYuIFn2y", - 'sub' : "allowed_sources"}) - host_list = json_loads(html) - host_list = host_list['allow'] - return host_list diff --git a/module/plugins/hooks/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py deleted file mode 100644 index 1380433bf..000000000 --- a/module/plugins/hooks/FreeWayMeHook.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class FreeWayMeHook(MultiHook): - __name__ = "FreeWayMeHook" - __type__ = "hook" - __version__ = "0.18" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """FreeWay.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Nicolas Giese", "james@free-way.me")] - - - def get_hosters(self): - user, info = self.account.select() - hostis = self.load("http://www.free-way.bz/ajax/jd.php", - get={'id' : 3, - 'user': user, - 'pass': info['login']['password']}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 - return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/HighWayMeHook.py b/module/plugins/hooks/HighWayMeHook.py deleted file mode 100644 index e9e62525d..000000000 --- a/module/plugins/hooks/HighWayMeHook.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class HighWayMeHook(MultiHook): - __name__ = "HighWayMeHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """High-Way.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - - - def get_hosters(self): - json_data = json_loads(self.load("https://high-way.me/api.php", - get={'hoster': 1})) - return [element['name'] for element in json_data['hoster']] diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index 84db4db17..5a65146b9 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -14,7 +14,7 @@ from module.utils import fs_encode, save_join as fs_join class HotFolder(Addon): __name__ = "HotFolder" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __config__ = [("folder" , "str" , "Folder to observe" , "container"), @@ -29,6 +29,7 @@ class HotFolder(Addon): def init(self): self.interval = 30 + self.init_periodical() def periodical(self): diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 08b1bad0c..c84c0439d 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -18,7 +18,7 @@ from module.utils import formatSize class IRCInterface(Thread, Addon): __name__ = "IRCInterface" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.17" __status__ = "testing" __config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"), @@ -40,7 +40,7 @@ class IRCInterface(Thread, Addon): def __init__(self, core, manager): Thread.__init__(self) Addon.__init__(self, core, manager) - self.set_daemon(True) + self.setDaemon(True) def activate(self): @@ -55,6 +55,7 @@ class IRCInterface(Thread, Addon): try: if self.get_config('info_pack'): self.response(_("Package finished: %s") % pypack.name) + except Exception: pass @@ -64,6 +65,7 @@ class IRCInterface(Thread, Addon): if self.get_config('info_file'): self.response( _("Download finished: %(name)s @ %(plugin)s ") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) + except Exception: pass @@ -103,7 +105,8 @@ class IRCInterface(Thread, Addon): except IRCError, ex: self.sock.send("QUIT :byebye\r\n") - traceback.print_exc() + if self.pyload.debug: + traceback.print_exc() self.sock.close() @@ -177,6 +180,7 @@ class IRCInterface(Thread, Addon): trigger = temp[0] if len(temp) > 1: args = temp[1:] + except Exception: pass @@ -185,6 +189,7 @@ class IRCInterface(Thread, Addon): res = handler(args) for line in res: self.response(line, msg['origin']) + except Exception, e: self.log_error(e) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 42ab99027..85c22f1da 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -61,6 +61,7 @@ class ImageTyperz(Hook): try: balance = float(res) + except Exception: raise ImageTyperzException("Invalid response") diff --git a/module/plugins/hooks/LinksnappyComHook.py b/module/plugins/hooks/LinksnappyComHook.py deleted file mode 100644 index e46e480d6..000000000 --- a/module/plugins/hooks/LinksnappyComHook.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class LinksnappyComHook(MultiHook): - __name__ = "LinksnappyComHook" - __type__ = "hook" - __version__ = "0.05" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Linksnappy.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def get_hosters(self): - json_data = self.load("http://gen.linksnappy.com/lseAPI.php", get={'act': "FILEHOSTS"}) - json_data = json_loads(json_data) - - return json_data['return'].keys() diff --git a/module/plugins/hooks/MegaDebridEuHook.py b/module/plugins/hooks/MegaDebridEuHook.py deleted file mode 100644 index 04f0be86f..000000000 --- a/module/plugins/hooks/MegaDebridEuHook.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class MegaDebridEuHook(MultiHook): - __name__ = "MegaDebridEuHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Mega-debrid.eu hook plugin""" - __license__ = "GPLv3" - __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] - - - def get_hosters(self): - reponse = self.load("http://www.mega-debrid.eu/api.php", get={'action': "getHosters"}) - json_data = json_loads(reponse) - - if json_data['response_code'] == "ok": - host_list = [element[0] for element in json_data['hosters']] - else: - self.log_error(_("Unable to retrieve hoster list")) - host_list = [] - - return host_list diff --git a/module/plugins/hooks/MegaRapidoNetHook.py b/module/plugins/hooks/MegaRapidoNetHook.py deleted file mode 100644 index 4956427ff..000000000 --- a/module/plugins/hooks/MegaRapidoNetHook.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class MegaRapidoNetHook(MultiHook): - __name__ = "MegaRapidoNetHook" - __type__ = "hook" - __version__ = "0.03" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """MegaRapido.net hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - - def get_hosters(self): - hosters = {'1fichier' : [], # leave it there are so many possible addresses? - '1st-files' : ['1st-files.com'], - '2shared' : ['2shared.com'], - '4shared' : ['4shared.com', '4shared-china.com'], - 'asfile' : ['http://asfile.com/'], - 'bitshare' : ['bitshare.com'], - 'brupload' : ['brupload.net'], - 'crocko' : ['crocko.com', 'easy-share.com'], - 'dailymotion' : ['dailymotion.com'], - 'depfile' : ['depfile.com'], - 'depositfiles': ['depositfiles.com', 'dfiles.eu'], - 'dizzcloud' : ['dizzcloud.com'], - 'dl.dropbox' : [], - 'extabit' : ['extabit.com'], - 'extmatrix' : ['extmatrix.com'], - 'facebook' : [], - 'file4go' : ['file4go.com'], - 'filecloud' : ['filecloud.io', 'ifile.it', 'mihd.net'], - 'filefactory' : ['filefactory.com'], - 'fileom' : ['fileom.com'], - 'fileparadox' : ['fileparadox.in'], - 'filepost' : ['filepost.com', 'fp.io'], - 'filerio' : ['filerio.in', 'filerio.com', 'filekeen.com'], - 'filesflash' : ['filesflash.com'], - 'firedrive' : ['firedrive.com', 'putlocker.com'], - 'flashx' : [], - 'freakshare' : ['freakshare.net', 'freakshare.com'], - 'gigasize' : ['gigasize.com'], - 'hipfile' : ['hipfile.com'], - 'junocloud' : ['junocloud.me'], - 'letitbit' : ['letitbit.net', 'shareflare.net'], - 'mediafire' : ['mediafire.com'], - 'mega' : ['mega.co.nz'], - 'megashares' : ['megashares.com'], - 'metacafe' : ['metacafe.com'], - 'netload' : ['netload.in'], - 'oboom' : ['oboom.com'], - 'rapidgator' : ['rapidgator.net'], - 'rapidshare' : ['rapidshare.com'], - 'rarefile' : ['rarefile.net'], - 'ryushare' : ['ryushare.com'], - 'sendspace' : ['sendspace.com'], - 'turbobit' : ['turbobit.net', 'unextfiles.com'], - 'uploadable' : ['uploadable.ch'], - 'uploadbaz' : ['uploadbaz.com'], - 'uploaded' : ['uploaded.to', 'uploaded.net', 'ul.to'], - 'uploadhero' : ['uploadhero.com'], - 'uploading' : ['uploading.com'], - 'uptobox' : ['uptobox.com'], - 'xvideos' : ['xvideos.com'], - 'youtube' : ['youtube.com']} - - hoster_list = [] - - for item in hosters.values(): - hoster_list.extend(item) - - return hoster_list diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index a76a578bf..c6405e5a3 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -4,7 +4,6 @@ from __future__ import with_statement import os import re -import traceback from module.plugins.internal.Addon import Addon, threaded from module.utils import save_join as fs_join @@ -13,7 +12,7 @@ from module.utils import save_join as fs_join class MergeFiles(Addon): __name__ = "MergeFiles" __type__ = "hook" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __config__ = [("activated", "bool", "Activated", True)] @@ -69,7 +68,7 @@ class MergeFiles(Addon): self.log_debug("Finished merging part", splitted_file) except Exception, e: - traceback.print_exc() + self.log_error(e) finally: pyfile.setProgress(100) diff --git a/module/plugins/hooks/MultihostersComHook.py b/module/plugins/hooks/MultihostersComHook.py deleted file mode 100644 index ec1cf9c85..000000000 --- a/module/plugins/hooks/MultihostersComHook.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.hooks.ZeveraComHook import ZeveraComHook - - -class MultihostersComHook(ZeveraComHook): - __name__ = "MultihostersComHook" - __type__ = "hook" - __version__ = "0.03" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Multihosters.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hooks/MultishareCzHook.py b/module/plugins/hooks/MultishareCzHook.py deleted file mode 100644 index 30f1e21b5..000000000 --- a/module/plugins/hooks/MultishareCzHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.MultiHook import MultiHook - - -class MultishareCzHook(MultiHook): - __name__ = "MultishareCzHook" - __type__ = "hook" - __version__ = "0.08" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """MultiShare.cz hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="(.+?)"></td>\s*<td class="stav">[^>]*?alt="OK"' - - - def get_hosters(self): - html = self.load("http://www.multishare.cz/monitoring/") - return re.findall(self.HOSTER_PATTERN, html) diff --git a/module/plugins/hooks/MyfastfileComHook.py b/module/plugins/hooks/MyfastfileComHook.py deleted file mode 100644 index 1eedd9238..000000000 --- a/module/plugins/hooks/MyfastfileComHook.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class MyfastfileComHook(MultiHook): - __name__ = "MyfastfileComHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Myfastfile.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it")] - - - def get_hosters(self): - json_data = self.load("http://myfastfile.com/api.php", get={'hosts': ""}) - self.log_debug("JSON data", json_data) - json_data = json_loads(json_data) - - return json_data['hosts'] diff --git a/module/plugins/hooks/NoPremiumPlHook.py b/module/plugins/hooks/NoPremiumPlHook.py deleted file mode 100644 index 7dbdf6a68..000000000 --- a/module/plugins/hooks/NoPremiumPlHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class NoPremiumPlHook(MultiHook): - __name__ = "NoPremiumPlHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """NoPremium.pl hook plugin""" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] - - - def get_hosters(self): - hostings = json_loads(self.load("https://www.nopremium.pl/clipboard.php?json=3").strip()) - hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] - - self.log_debug(hostings_domains) - - return hostings_domains diff --git a/module/plugins/hooks/OverLoadMeHook.py b/module/plugins/hooks/OverLoadMeHook.py deleted file mode 100644 index 5398fc17d..000000000 --- a/module/plugins/hooks/OverLoadMeHook.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class OverLoadMeHook(MultiHook): - __name__ = "OverLoadMeHook" - __type__ = "hook" - __version__ = "0.05" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Over-Load.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("marley", "marley@over-load.me")] - - - def get_hosters(self): - html = self.load("https://api.over-load.me/hoster.php", - get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/PremiumToHook.py b/module/plugins/hooks/PremiumToHook.py deleted file mode 100644 index bcd7a7aab..000000000 --- a/module/plugins/hooks/PremiumToHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class PremiumToHook(MultiHook): - __name__ = "PremiumToHook" - __type__ = "hook" - __version__ = "0.11" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Premium.to hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), - ("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it")] - - - def get_hosters(self): - user, info = self.account.select() - html = self.load("http://premium.to/api/hosters.php", - get={'username': user, - 'password': info['login']['password']}) - return [x.strip() for x in html.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/PremiumizeMeHook.py b/module/plugins/hooks/PremiumizeMeHook.py deleted file mode 100644 index 9a9a380af..000000000 --- a/module/plugins/hooks/PremiumizeMeHook.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class PremiumizeMeHook(MultiHook): - __name__ = "PremiumizeMeHook" - __type__ = "hook" - __version__ = "0.20" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Premiumize.me hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - - - def get_hosters(self): - #: Get account data - user, info = self.account.select() - - #: Get supported hosters list from premiumize.me using the - #: json API v1 (see https://secure.premiumize.me/?show=api) - answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 - get={'method' : "hosterlist", - 'params[login]': user, - 'params[pass]' : info['login']['password']}) - data = json_loads(answer) - - #: If account is not valid thera are no hosters available - if data['status'] != 200: - return [] - - #: Extract hosters from json file - return data['result']['hosterlist'] diff --git a/module/plugins/hooks/PutdriveComHook.py b/module/plugins/hooks/PutdriveComHook.py deleted file mode 100644 index d206aaf88..000000000 --- a/module/plugins/hooks/PutdriveComHook.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.hooks.ZeveraComHook import ZeveraComHook - - -class PutdriveComHook(ZeveraComHook): - __name__ = "PutdriveComHook" - __type__ = "hook" - __version__ = "0.02" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Putdrive.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hooks/RPNetBizHook.py b/module/plugins/hooks/RPNetBizHook.py deleted file mode 100644 index 5d26b7f09..000000000 --- a/module/plugins/hooks/RPNetBizHook.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class RPNetBizHook(MultiHook): - __name__ = "RPNetBizHook" - __type__ = "hook" - __version__ = "0.16" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """RPNet.biz hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Dman", "dmanugm@gmail.com")] - - - def get_hosters(self): - #: Get account data - user, info = self.account.select() - - res = self.load("https://premium.rpnet.biz/client_api.php", - get={'username': user, - 'password': info['login']['password'], - 'action' : "showHosterList"}) - hoster_list = json_loads(res) - - #: If account is not valid thera are no hosters available - if 'error' in hoster_list: - return [] - - #: Extract hosters from json file - return hoster_list['hosters'] diff --git a/module/plugins/hooks/RapideoPlHook.py b/module/plugins/hooks/RapideoPlHook.py deleted file mode 100644 index 130f73851..000000000 --- a/module/plugins/hooks/RapideoPlHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class RapideoPlHook(MultiHook): - __name__ = "RapideoPlHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Rapideo.pl hook plugin""" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] - - - def get_hosters(self): - hostings = json_loads(self.load("https://www.rapideo.pl/clipboard.php?json=3").strip()) - hostings_domains = [domain for row in hostings for domain in row['domains'] if row['sdownload'] == "0"] - - self.log_debug(hostings_domains) - - return hostings_domains diff --git a/module/plugins/hooks/RealdebridComHook.py b/module/plugins/hooks/RealdebridComHook.py deleted file mode 100644 index 01b9d165e..000000000 --- a/module/plugins/hooks/RealdebridComHook.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class RealdebridComHook(MultiHook): - __name__ = "RealdebridComHook" - __type__ = "hook" - __version__ = "0.47" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Real-Debrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] - - - def get_hosters(self): - html = self.load("https://real-debrid.com/api/hosters.php").replace("\"", "").strip() - return [x.strip() for x in html.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostToHook.py b/module/plugins/hooks/RehostToHook.py deleted file mode 100644 index 7bb27e820..000000000 --- a/module/plugins/hooks/RehostToHook.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class RehostToHook(MultiHook): - __name__ = "RehostToHook" - __type__ = "hook" - __version__ = "0.51" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Rehost.to hook plugin""" - __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org")] - - - def get_hosters(self): - user, info = self.account.select() - html = self.load("http://rehost.to/api.php", - get={'cmd' : "get_supported_och_dl", - 'long_ses': self.account.get_data(user)['session']}) - return [x.strip() for x in html.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SimplyPremiumComHook.py b/module/plugins/hooks/SimplyPremiumComHook.py deleted file mode 100644 index 6fbd75c8a..000000000 --- a/module/plugins/hooks/SimplyPremiumComHook.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.common.json_layer import json_loads -from module.plugins.internal.MultiHook import MultiHook - - -class SimplyPremiumComHook(MultiHook): - __name__ = "SimplyPremiumComHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Simply-Premium.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("EvolutionClip", "evolutionclip@live.de")] - - - def get_hosters(self): - json_data = self.load("http://www.simply-premium.com/api/hosts.php", get={'format': "json", 'online': 1}) - json_data = json_loads(json_data) - - host_list = [element['regex'] for element in json_data['result']] - - return host_list diff --git a/module/plugins/hooks/SimplydebridComHook.py b/module/plugins/hooks/SimplydebridComHook.py deleted file mode 100644 index 0da7ec719..000000000 --- a/module/plugins/hooks/SimplydebridComHook.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class SimplydebridComHook(MultiHook): - __name__ = "SimplydebridComHook" - __type__ = "hook" - __version__ = "0.05" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Simply-Debrid.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - - - def get_hosters(self): - html = self.load("http://simply-debrid.com/api.php", get={'list': 1}) - return [x.strip() for x in html.rstrip(';').replace("\"", "").split(";")] diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index a1ddc3094..5f9cfa452 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -2,7 +2,6 @@ import re import urllib -import urlparse from types import MethodType @@ -13,7 +12,7 @@ from module.plugins.internal.Addon import Addon class SkipRev(Addon): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.33" + __version__ = "0.34" __status__ = "testing" __config__ = [("mode" , "Auto;Manual", "Choose recovery archives to skip" , "Auto"), @@ -24,13 +23,6 @@ class SkipRev(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - @staticmethod - def _init(self): - self.pyfile.plugin._init() - if self.pyfile.hasStatus("skipped"): - self.skip(self.pyfile.statusname or self.pyfile.pluginname) - - def _name(self, pyfile): return pyfile.pluginclass.get_info(pyfile.url)['name'] @@ -68,11 +60,6 @@ class SkipRev(Addon): pyfile.setCustomStatus("SkipRev", "skipped") - if not hasattr(pyfile.plugin, "_init"): - #: Work-around: inject status checker inside the preprocessing routine of the plugin - pyfile.plugin._init = pyfile.plugin.init - pyfile.plugin.init = MethodType(self._init, pyfile.plugin) - def download_failed(self, pyfile): #: Check if pyfile is still "failed", maybe might has been restarted in meantime diff --git a/module/plugins/hooks/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py deleted file mode 100644 index b9825b223..000000000 --- a/module/plugins/hooks/SmoozedComHook.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class SmoozedComHook(MultiHook): - __name__ = "SmoozedComHook" - __type__ = "hook" - __version__ = "0.04" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Smoozed.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("", "")] - - - def get_hosters(self): - user, info = self.account.select() - return self.account.get_data(user)['hosters'] diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py new file mode 100644 index 000000000..715f82edb --- /dev/null +++ b/module/plugins/hooks/TransmissionRPC.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +import random +import re + +import pycurl + +from module.common.json_layer import json_loads, json_dumps +from module.network.HTTPRequest import BadHeader +from module.network.RequestFactory import getRequest as get_request +from module.plugins.internal.Addon import Addon + + +class TransmissionRPC(Addon): + __name__ = "TransmissionRPC" + __type__ = "hook" + __version__ = "0.12" + __status__ = "testing" + + __pattern__ = r"https?://.+\.torrent|magnet:\?.+" + __config__ = [("rpc_url", "str", "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")] + + __description__ = """Send torrent and magnet URLs to Transmission Bittorent daemon via RPC""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + def init(self): + self.event_map = {'linksAdded': "links_added"} + + + def links_added(self, links, pid): + pattern = re.compile(self.__pattern__) + urls = [link for link in links if pattern.match(link)] + + for url in urls: + self.log_debug("Sending link: %s" % url) + self.send_to_transmission(url) + links.remove(url) + + + def send_to_transmission(self, url): + transmission_rpc_url = self.get_config('rpc_url') + client_request_id = self.__name__ + "".join(random.choice('0123456789ABCDEF') for _i in xrange(4)) + req = get_request() + + try: + response = self.load(transmission_rpc_url, + post=json_dumps({'arguments': {'filename': url}, + 'method' : 'torrent-add', + 'tag' : client_request_id}), + req=req) + + except BadHeader, e: + if e.code == 409: + headers = dict(re.findall(r"(?P<name>.+?): (?P<value>.+?)\r?\n", req.header)) + session_id = headers['X-Transmission-Session-Id'] + req.c.setopt(pycurl.HTTPHEADER, ["X-Transmission-Session-Id: %s" % session_id]) + try: + response = self.load(transmission_rpc_url, + post=json_dumps({'arguments': {'filename': url}, + 'method' : 'torrent-add', + 'tag' : client_request_id}), + req=req) + + except Exception, e: + self.log_error(e) + return + + else: + self.log_error(e) + return + + except Exception, e: + self.log_error(e) + return + + try: + res = json_loads(response) + if "result" in res: + self.log_debug("Result: %s" % res['result']) + + except Exception, e: + self.log_error(e) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 117da0633..312355675 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -7,7 +7,6 @@ import os import re import sys import time -import traceback from module.plugins.internal.Addon import Expose, Addon, threaded from module.plugins.internal.Plugin import exists @@ -17,7 +16,7 @@ from module.utils import fs_encode, save_join as fs_join class UpdateManager(Addon): __name__ = "UpdateManager" __type__ = "hook" - __version__ = "0.55" + __version__ = "0.56" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -80,8 +79,8 @@ class UpdateManager(Addon): if self.get_config('nodebugupdate'): return - if self.get_config('checkperiod') \ - and time.time() - max(self.MIN_CHECK_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']: + if self.get_config('checkperiod') and \ + time.time() - max(self.MIN_CHECK_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']: self.update() @@ -268,9 +267,7 @@ class UpdateManager(Addon): raise Exception(_("Version mismatch")) except Exception, e: - self.log_error(_("Error updating plugin: %s") % filename, e) - if self.pyload.debug: - traceback.print_exc() + self.log_error(_("Error updating plugin: [%s] %s") % (type, name), e) if updated: self.log_info(_("*** Plugins updated ***")) @@ -278,7 +275,7 @@ class UpdateManager(Addon): if self.pyload.pluginManager.reloadPlugins(updated): exitcode = 1 else: - self.log_warning(_("pyLoad restart required to reload the updated plugins")) + self.log_warning(_("You have to restart pyLoad to reload the updated plugins")) self.info['plugins'] = True exitcode = 2 @@ -337,8 +334,6 @@ class UpdateManager(Addon): except OSError, e: self.log_warning(_("Error removing: %s") % filename, e) - if self.pyload.debug: - traceback.print_exc() else: id = (type, name) diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 7567a31a3..70bafba67 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.internal.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.42" + __version__ = "0.43" __status__ = "testing" __config__ = [("activated" , "bool", "Activated" , True ), @@ -28,20 +28,22 @@ class XFileSharingPro(Hook): 'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P<DOMAIN>(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} - HOSTER_BUILTIN = [#WORKING HOSTERS: - "ani-stream.com", "backin.net", "cloudsix.me", "eyesfile.ca", "file4safe.com", - "fileband.com", "filedwon.com", "fileparadox.in", "filevice.com", - "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", - "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.com", - "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com", "xvidstage.com", - #: NOT TESTED: - "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", - "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharerepo.com", - "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com", - "zalaa.com", "zomgupload.com", - #: NOT WORKING: - "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] - CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] + BUILTIN_HOSTERS = [#WORKING HOSTERS: + "ani-stream.com", "backin.net", "cloudsix.me", "eyesfile.ca", + "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", + "filevice.com", "hostingbulk.com", "junkyvideo.com", "ravishare.com", + "ryushare.com", "salefiles.com", "sendmyway.com", "sharebeast.com", + "sharesix.com", "thefile.me", "verzend.be", "worldbytez.com", + "xvidstage.com", + #: NOT TESTED: + "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", + "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharerepo.com", + "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com", + "zalaa.com", "zomgupload.com", + #: NOT WORKING: + "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", + "laoupload.com", "rd-fs.com"] + BUILTIN_CRYPTERS = ["junocloud.me", "rapidfileshare.net"] # def plugin_config_changed(self, plugin, name, value): @@ -71,7 +73,7 @@ class XFileSharingPro(Hook): plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(',')) if use_builtin_list: - plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper())) + plugin_set |= set(x.lower() for x in getattr(self, "BUILTIN_%sS" % type.upper())) plugin_set -= set(('', u'')) diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index 50dd40774..77e20cdd4 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -70,6 +70,7 @@ class XMPPInterface(IRCInterface, JabberClient): try: if self.get_config('info_pack'): self.announce(_("Package finished: %s") % pypack.name) + except Exception: pass @@ -79,6 +80,7 @@ class XMPPInterface(IRCInterface, JabberClient): if self.get_config('info_file'): self.announce( _("Download finished: %(name)s @ %(plugin)s") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) + except Exception: pass @@ -88,6 +90,7 @@ class XMPPInterface(IRCInterface, JabberClient): self.connect() try: self.loop() + except Exception, ex: self.log_error(ex) @@ -159,6 +162,7 @@ class XMPPInterface(IRCInterface, JabberClient): trigger = temp[0] if len(temp) > 1: args = temp[1:] + except Exception: pass @@ -174,6 +178,7 @@ class XMPPInterface(IRCInterface, JabberClient): body=line) messages.append(m) + except Exception, e: self.log_error(e) diff --git a/module/plugins/hooks/ZeveraComHook.py b/module/plugins/hooks/ZeveraComHook.py deleted file mode 100644 index 395c67802..000000000 --- a/module/plugins/hooks/ZeveraComHook.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.MultiHook import MultiHook - - -class ZeveraComHook(MultiHook): - __name__ = "ZeveraComHook" - __type__ = "hook" - __version__ = "0.06" - __status__ = "testing" - - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - - __description__ = """Zevera.com hook plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com" )] - - - def get_hosters(self): - html = self.account.api_response(pyreq.getHTTPRequest(timeout=120), cmd="gethosters") - return [x.strip() for x in html.split(",")] |