diff options
author | ardi69 <armin@diedering.de> | 2015-04-16 22:33:28 +0200 |
---|---|---|
committer | ardi69 <armin@diedering.de> | 2015-04-16 22:33:28 +0200 |
commit | 21c2ac71d045ae50a705d8ab0ac1e960d462e001 (patch) | |
tree | 896ff1eaae9151d83be150735c96a37a61d2d038 | |
parent | fixed: more typos (diff) | |
parent | Merge pull request #5 from ardi69/0.4.10 (diff) | |
download | pyload-21c2ac71d045ae50a705d8ab0ac1e960d462e001.tar.xz |
Merge pull request #2 from vuolter/0.4.10
merge from vuolter
77 files changed, 741 insertions, 679 deletions
diff --git a/docs/build_docs.py b/docs/build_docs.py index 82dd75e0b..15fc2070d 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -21,10 +21,6 @@ dir_name = os.path.join(os.path.dirname(os.path.abspath(""))) sys.path.append(dir_name) -if "64" in platform.machine(): - sys.path.append(os.path.join(os.path.dirname, "lib64")) -sys.path.append(os.path.join(os.path.dirname, "lib", "Python", "Lib")) - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/docs/write_plugins.rst b/docs/write_plugins.rst index 6c2a1d453..64868d638 100644 --- a/docs/write_plugins.rst +++ b/docs/write_plugins.rst @@ -92,7 +92,7 @@ Example: :: urls = ["http://get.pyload.org/src", "http://get.pyload.org/debian", "http://get.pyload.org/win"] - self.packages.append(("pyLoad packages", urls, "pyLoad packages")) # urls list of urls + self.packages.append(("pyLoad packages", urls, "pyLoad packages")) #: urls list of urls They can access all the methods from :class:`Plugin <pyload.plugin.Plugin.Plugin>`, but the important thing is they have to append all packages they parsed to the `self.packages` list. Simply append tuples with `(name, urls, folder)`, diff --git a/locale/pavement.py b/locale/pavement.py index 0cdfb4872..5e24ce9f2 100644 --- a/locale/pavement.py +++ b/locale/pavement.py @@ -44,7 +44,7 @@ setup( #package_data=find_package_data(), #data_files=[], include_package_data=True, - exclude_package_data={'pyload': ["docs*", "scripts*", "tests*"]}, #exluced from build but not from sdist + exclude_package_data={'pyload': ["docs*", "scripts*", "tests*"]}, #: exluced from build but not from sdist # 'bottle >= 0.10.0' not in list, because its small and contain little modifications install_requires=['thrift >= 0.8.0', 'jinja2', 'pycurl', 'Beaker', 'BeautifulSoup >= 3.2, < 3.3'] + extradeps, extras_require={ @@ -360,7 +360,7 @@ def clean(): path("dist").rmtree() -#helper functions +# helper functions def walk_trans(path, EXCLUDE, endings=[".py"]): result = "" diff --git a/pyload/Core.py b/pyload/Core.py index c79c832e1..4a919b689 100755 --- a/pyload/Core.py +++ b/pyload/Core.py @@ -56,7 +56,7 @@ class Core(object): self.remote = True self.arg_links = [] self.pidfile = "pyload.pid" - self.deleteLinks = False # will delete links on startup + self.deleteLinks = False #: will delete links on startup if len(argv) > 1: try: @@ -216,7 +216,7 @@ class Core(object): return try: - os.kill(pid, 3) #SIGUIT + os.kill(pid, 3) #: SIGUIT t = time() print "waiting for pyLoad to quit" @@ -227,7 +227,7 @@ class Core(object): if not exists(self.pidfile): print "pyLoad successfully stopped" else: - os.kill(pid, 9) #SIGKILL + os.kill(pid, 9) #: SIGKILL print "pyLoad did not respond" print "Kill signal was send to process with id %s" % pid @@ -282,46 +282,46 @@ class Core(object): gettext.setpaths([join(os.sep, "usr", "share", "pyload", "locale"), None]) translation = gettext.translation("pyLoad", self.path("locale"), - languages=[self.config['general']['language'], "en"], fallback=True) + languages=[self.config.get("general", "language"), "en"], fallback=True) translation.install(True) - self.debug = self.doDebug or self.config['general']['debug_mode'] - self.remote &= self.config['remote']['activated'] + self.debug = self.doDebug or self.config.get("general", "debug_mode") + self.remote &= self.config.get("remote", "activated") pid = self.isAlreadyRunning() if pid: print _("pyLoad already running with pid %s") % pid exit() - if os.name != "nt" and self.config["general"]["renice"]: - os.system("renice %d %d" % (self.config["general"]["renice"], os.getpid())) + if os.name != "nt" and self.config.get("general", "renice"): + os.system("renice %d %d" % (self.config.get("general", "renice"), os.getpid())) - if self.config["permission"]["change_group"]: + if self.config.get("permission", "change_group"): if os.name != "nt": try: from grp import getgrnam - group = getgrnam(self.config["permission"]["group"]) + group = getgrnam(self.config.get("permission", "group")) os.setgid(group[2]) except Exception, e: print _("Failed changing group: %s") % e - if self.config["permission"]["change_user"]: + if self.config.get("permission", "change_user"): if os.name != "nt": try: from pwd import getpwnam - user = getpwnam(self.config["permission"]["user"]) + user = getpwnam(self.config.get("permission", "user")) os.setuid(user[2]) except Exception, e: print _("Failed changing user: %s") % e - self.check_file(self.config['log']['log_folder'], _("folder for logs"), True) + self.check_file(self.config.get("log", "log_folder"), _("folder for logs"), True) if self.debug: - self.init_logger(logging.DEBUG) # logging level + self.init_logger(logging.DEBUG) #: logging level else: - self.init_logger(logging.INFO) # logging level + self.init_logger(logging.INFO) #: logging level self.do_kill = False self.do_restart = False @@ -343,11 +343,11 @@ class Core(object): self.check_file("tmp", _("folder for temporary files"), True) #tesser = self.check_install("tesseract", _("tesseract for captcha reading"), False) if os.name != "nt" else True - self.captcha = True # checks seems to fail, although tesseract is available + self.captcha = True #: checks seems to fail, although tesseract is available - self.check_file(self.config['general']['download_folder'], _("folder for downloads"), True) + self.check_file(self.config.get("general", "download_folder"), _("folder for downloads"), True) - if self.config['ssl']['activated']: + if self.config.get("ssl", "activated"): self.check_install("OpenSSL", _("OpenSSL for secure connection")) self.setupDB() @@ -397,11 +397,11 @@ class Core(object): if web: self.init_webserver() - spaceLeft = freeSpace(self.config["general"]["download_folder"]) + spaceLeft = freeSpace(self.config.get("general", "download_folder")) self.log.info(_("Free space: %s") % formatSize(spaceLeft)) - self.config.save() #save so config files gets filled + self.config.save() #: save so config files gets filled link_file = join(pypath, "links.txt") @@ -441,47 +441,77 @@ class Core(object): self.shutdown() self.log.info(_("pyLoad quits")) self.removeLogger() - _exit(0) #@TODO thrift blocks shutdown + _exit(0) #@TODO thrift blocks shutdown self.threadManager.work() self.scheduler.work() def setupDB(self): - self.db = DatabaseBackend(self) # the backend + self.db = DatabaseBackend(self) #: the backend self.db.setup() self.files = FileHandler(self) - self.db.manager = self.files #ugly? + self.db.manager = self.files #: ugly? def init_webserver(self): - if self.config['webui']['activated']: + if self.config.get("webui", "activated"): self.webserver = WebServer(self) self.webserver.start() def init_logger(self, level): + self.log = logging.getLogger("log") + self.log.setLevel(level) + + date_fmt = "%Y-%m-%d %H:%M:%S" + fh_fmt = "%(asctime)s %(levelname)-8s %(message)s" + + fh_frm = logging.Formatter(fh_fmt, date_fmt) #: file handler formatter + console_frm = fh_frm #: console formatter did not use colors as default + + # Console formatter with colors + if self.config.get("log", "color_console"): + import colorlog + + if self.config.get("log", "color_template") == "label": + cfmt = "%(asctime)s %(log_color)s%(bold)s%(white)s %(levelname)-8s %(reset)s %(message)s" + clr = {'DEBUG' : "bg_cyan" , + 'INFO' : "bg_green" , + 'WARNING' : "bg_yellow", + 'ERROR' : "bg_red" , + 'CRITICAL': "bg_purple"} + else: + cfmt = "%(log_color)s%(asctime)s %(levelname)-8s %(message)s" + clr = {'DEBUG' : "cyan" , + 'WARNING' : "yellow", + 'ERROR' : "red" , + 'CRITICAL': "purple"} + + console_frm = colorlog.ColoredFormatter(cfmt, date_fmt, clr) + + # Set console formatter console = logging.StreamHandler(sys.stdout) - frm = logging.Formatter("%(asctime)s %(levelname)-8s %(message)s", "%d.%m.%Y %H:%M:%S") - console.setFormatter(frm) - self.log = logging.getLogger("log") # settable in config - - if self.config['log']['file_log']: - if self.config['log']['log_rotate']: - file_handler = logging.handlers.RotatingFileHandler(join(self.config['log']['log_folder'], 'log.txt'), - maxBytes=self.config['log']['log_size'] * 1024, - backupCount=int(self.config['log']['log_count']), + console.setFormatter(console_frm) + self.log.addHandler(console) + + if not exists(self.config.get("log", "log_folder")): + makedirs(self.config.get("log", "log_folder"), 0700) + + # Set file handler formatter + if self.config.get("log", "file_log"): + if self.config.get("log", "log_rotate"): + file_handler = logging.handlers.RotatingFileHandler(join(self.config.get("log", "log_folder"), 'log.txt'), + maxBytes=self.config.get("log", "log_size") * 1024, + backupCount=int(self.config.get("log", "log_count")), encoding="utf8") else: - file_handler = logging.FileHandler(join(self.config['log']['log_folder'], 'log.txt'), encoding="utf8") + file_handler = logging.FileHandler(join(self.config.get("log", "log_folder"), 'log.txt'), encoding="utf8") - file_handler.setFormatter(frm) + file_handler.setFormatter(fh_frm) self.log.addHandler(file_handler) - self.log.addHandler(console) #if console logging - self.log.setLevel(level) - def removeLogger(self): for h in list(self.log.handlers): @@ -566,7 +596,7 @@ class Core(object): def shutdown(self): self.log.info(_("shutting down...")) try: - if self.config['webui']['activated'] and hasattr(self, "webserver"): + if self.config.get("webui", "activated") and hasattr(self, "webserver"): self.webserver.quit() for thread in list(self.threadManager.threads): diff --git a/pyload/__init__.py b/pyload/__init__.py index 1ca7c4fdc..7f5ac0667 100644 --- a/pyload/__init__.py +++ b/pyload/__init__.py @@ -55,6 +55,8 @@ __builtin__.pypath = os.path.abspath(os.path.join(rootdir, "..")) if "64" in platform.machine(): sys.path.append(os.path.join(pypath, "lib64")) sys.path.append(os.path.join(pypath, "lib", "Python", "Lib")) +sys.path.append(os.path.join(pypath, "lib")) + sys.stdout = getwriter(get_console_encoding(sys.stdout.encoding))(sys.stdout, errors="replace") diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py index 8c114cea4..461c77cac 100644 --- a/pyload/api/__init__.py +++ b/pyload/api/__init__.py @@ -129,7 +129,7 @@ class Api(Iface): :return: config value as string """ if section == "core": - value = self.core.config[category][option] + value = self.core.config.get(category, option) else: value = self.core.config.getPlugin(category, option) return str(value) @@ -215,8 +215,8 @@ class Api(Iface): :return: new reconnect state """ - self.core.config["reconnect"]["activated"] ^= True - return self.core.config["reconnect"]["activated"] + self.core.config['reconnect']['activated'] ^= True + return self.core.config.get("reconnect", "activated") @permission(PERMS.LIST) @@ -228,7 +228,7 @@ class Api(Iface): serverStatus = ServerStatus(self.core.threadManager.pause, len(self.core.threadManager.processingIds()), self.core.files.getQueueCount(), self.core.files.getFileCount(), 0, not self.core.threadManager.pause and self.isTimeDownload(), - self.core.config['reconnect']['activated'] and self.isTimeReconnect()) + self.core.config.get("reconnect", "activated") and self.isTimeReconnect()) for pyfile in [x.active for x in self.core.threadManager.threads if x.active and isinstance(x.active, PyFile)]: serverStatus.speed += pyfile.getSpeed() # bytes/s return serverStatus @@ -237,7 +237,7 @@ class Api(Iface): @permission(PERMS.STATUS) def freeSpace(self): """Available free space at download directory in bytes""" - return freeSpace(self.core.config["general"]["download_folder"]) + return freeSpace(self.core.config.get("general", "download_folder")) @permission(PERMS.ALL) @@ -263,7 +263,7 @@ class Api(Iface): :param offset: line offset :return: List of log entries """ - filename = join(self.core.config['log']['log_folder'], 'log.txt') + filename = join(self.core.config.get("log", "log_folder"), 'log.txt') try: fh = open(filename, "r") lines = fh.readlines() @@ -281,8 +281,8 @@ class Api(Iface): :return: bool """ - start = self.core.config['downloadTime']['start'].split(":") - end = self.core.config['downloadTime']['end'].split(":") + start = self.core.config.get("downloadTime", "start").split(":") + end = self.core.config.get("downloadTime", "end").split(":") return compare_time(start, end) @@ -292,9 +292,9 @@ class Api(Iface): :return: bool """ - start = self.core.config['reconnect']['startTime'].split(":") - end = self.core.config['reconnect']['endTime'].split(":") - return compare_time(start, end) and self.core.config["reconnect"]["activated"] + start = self.core.config.get("reconnect", "startTime").split(":") + end = self.core.config.get("reconnect", "endTime").split(":") + return compare_time(start, end) and self.core.config.get("reconnect", "activated") @permission(PERMS.LIST) @@ -324,7 +324,7 @@ class Api(Iface): :param dest: `Destination` :return: package id of the new package """ - if self.core.config['general']['folder_per_package']: + if self.core.config.get("general", "folder_per_package"): folder = urlparse(name).path.split("/")[-1] else: folder = "" @@ -409,7 +409,7 @@ class Api(Iface): :param data: file content :return: online check """ - th = open(join(self.core.config["general"]["download_folder"], "tmp_" + container), "wb") + th = open(join(self.core.config.get("general", "download_folder"), "tmp_" + container), "wb") th.write(str(data)) th.close() return self.checkOnlineStatus(urls + [th.name]) @@ -707,7 +707,7 @@ class Api(Iface): :param filename: filename, extension is important so it can correctly decrypted :param data: file content """ - th = open(join(self.core.config["general"]["download_folder"], "tmp_" + filename), "wb") + th = open(join(self.core.config.get("general", "download_folder"), "tmp_" + filename), "wb") th.write(str(data)) th.close() self.addPackage(th.name, [th.name], Destination.Queue) @@ -945,7 +945,7 @@ class Api(Iface): :param remoteip: :return: dict with info, empty when login is incorrect """ - if self.core.config["remote"]["nolocalauth"] and remoteip == "127.0.0.1": + if self.core.config.get("remote", "nolocalauth") and remoteip == "127.0.0.1": return "local" else: return self.core.db.checkAuth(username, password) diff --git a/pyload/cli/Cli.py b/pyload/cli/Cli.py index 855ef47cc..4d6c3160d 100644 --- a/pyload/cli/Cli.py +++ b/pyload/cli/Cli.py @@ -81,8 +81,8 @@ class Cli(object): inp = self.getch.impl() if ord(inp) == 3: os.system("clear") - sys.exit() # ctrl + c - elif ord(inp) == 13: #enter + sys.exit() #: ctrl + c + elif ord(inp) == 13: #: enter try: self.lock.acquire() self.inputHandler.onEnter(self.input) @@ -93,14 +93,14 @@ class Cli(object): self.lock.release() elif ord(inp) == 127: - self.input = self.input[:-1] #backspace + self.input = self.input[:-1] #: backspace try: self.lock.acquire() self.inputHandler.onBackSpace() finally: self.lock.release() - elif ord(inp) == 27: #ugly symbol + elif ord(inp) == 27: #: ugly symbol pass else: self.input += inp @@ -143,7 +143,7 @@ class Cli(object): def renderHeader(self, line): """ prints download status """ #print updated information - # print "\033[J" #clear screen + # print "\033[J" #: clear screen # self.println(1, blue("py") + yellow("Load") + white(_(" Command Line Interface"))) # self.println(2, "") # self.println(3, white(_("%s Downloads:") % (len(data)))) diff --git a/pyload/config/default.conf b/pyload/config/default.conf index 69ac7216f..453c40b4b 100644 --- a/pyload/config/default.conf +++ b/pyload/config/default.conf @@ -1,65 +1,76 @@ -version: 1 +version: 2 remote - "Remote": - int port : "Port" = 7227 - ip listenaddr : "Address" = 0.0.0.0 - bool nolocalauth : "No authentication on local connections" = True - bool activated : "Activated" = True + bool activated : "Activated" = True + int port : "Port" = 7227 + ip listenaddr : "Address" = 0.0.0.0 + bool nolocalauth : "No authentication on local connections" = True + ssl - "SSL": - bool activated : "Activated"= False - file cert : "SSL Certificate" = ssl.crt - file key : "SSL Key" = ssl.key + bool activated : "Activated" = False + file cert : "SSL Certificate" = ssl.crt + file key : "SSL Key" = ssl.key + webui - "Web User Interface": - bool activated : "Activated" = True - builtin;threaded;fastcgi;lightweight server : "Server" = builtin - bool https : "Use HTTPS" = False - ip host : "IP" = 0.0.0.0 - int port : "Port" = 8001 - Default;Dark;Flat;Next theme : "Theme" = Next - str prefix: "Path Prefix" = + bool activated : "Activated" = True + builtin;threaded;fastcgi;lightweight server : "Server" = threaded + bool https : "Use HTTPS" = False + ip host : "IP" = 0.0.0.0 + int port : "Port" = 8001 + Default;Dark;Flat;Next theme : "Theme" = Next + str prefix : "Path Prefix" = None + log - "Log": - bool file_log : "File Log" = True - folder log_folder : "Folder" = Logs - int log_count : "Count" = 5 - int log_size : "Size in kb" = 100 - bool log_rotate : "Log Rotate" = True + bool file_log : "File Log" = True + folder log_folder : "Folder" = Logs + int log_count : "Count" = 5 + int log_size : "Size in kb" = 100 + bool log_rotate : "Log Rotate" = True + bool color_console : "Colored console" = True + label;full color_template : "Color template" = label + general - "General": - en;de;fr;it;es;nl;sv;ru;pl;cs;sr;pt_BR language : "Language" = en - folder download_folder : "Download Folder" = Downloads - bool debug_mode : "Debug Mode" = False - int min_free_space : "Min Free Space (MB)" = 200 - bool folder_per_package : "Create folder for each package" = True - int renice : "CPU Priority" = 0 - auto;common;pyv8;node;rhino;jsc jsengine : "JS Engine" = auto + en;de;fr;it;es;nl;sv;ru;pl;cs;sr;pt_BR language : "Language" = en + folder download_folder : "Download Folder" = Downloads + bool debug_mode : "Debug Mode" = False + int min_free_space : "Min Free Space (MB)" = 200 + bool folder_per_package : "Create folder for each package" = True + int renice : "CPU Priority" = 0 + auto;common;pyv8;node;rhino;jsc jsengine : "JS Engine" = auto + download - "Download": - int chunks : "Max connections for one download" = 3 - int max_downloads : "Max Parallel Downloads" = 3 - int max_speed : "Max Download Speed in kb/s" = -1 - bool limit_speed : "Limit Download Speed" = False - str interface : "Download interface to bind (ip or Name)" = None - bool ipv6: "Allow IPv6" = False - bool skip_existing : "Skip already existing files" = False + int chunks : "Max connections for one download" = 3 + int max_downloads : "Max Parallel Downloads" = 3 + int max_speed : "Max Download Speed in kb/s" = -1 + bool limit_speed : "Limit Download Speed" = False + str interface : "Download interface to bind (ip or Name)" = None + bool ipv6 : "Allow IPv6" = False + bool skip_existing : "Skip already existing files" = False + permission - "Permissions": - bool change_user : "Change user of running process" = False - str user : "Username" = user - str folder : "Folder Permission mode" = 0755 - bool change_file : "Change file mode of downloads" = False - str file : "Filemode for Downloads" = 0644 - bool change_group : "Change group of running process" = False - str group : "Groupname" = users - bool change_dl : "Change Group and User of Downloads" = False + bool change_user : "Change user of running process" = False + str user : "Username" = user + str folder : "Folder Permission mode" = 0755 + bool change_file : "Change file mode of downloads" = False + str file : "Filemode for Downloads" = 0644 + bool change_group : "Change group of running process" = False + str group : "Groupname" = users + bool change_dl : "Change Group and User of Downloads" = False + reconnect - "Reconnect": - bool activated : "Use Reconnect" = False - str method : "Method" = None - time startTime : "Start" = 0:00 - time endTime : "End" = 0:00 + bool activated : "Activated" = False + str method : "Method" = None + time startTime : "Start" = 0:00 + time endTime : "End" = 0:00 + downloadTime - "Download Time": - time start : "Start" = 0:00 - time end : "End" = 0:00 + time start : "Start" = 0:00 + time end : "End" = 0:00 + proxy - "Proxy": - str address : "Address" = "localhost" - int port : "Port" = 7070 - http;socks4;socks5 type : "Protocol" = http - str username : "Username" = None - password password : "Password" = None - bool proxy : "Use Proxy" = False + str address : "Address" = "localhost" + int port : "Port" = 7070 + http;socks4;socks5 type : "Protocol" = http + str username : "Username" = None + password password : "Password" = None + bool proxy : "Use Proxy" = False diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py index 116241a13..45a5c7361 100644 --- a/pyload/database/Backend.py +++ b/pyload/database/Backend.py @@ -129,12 +129,12 @@ class DatabaseBackend(Thread): def run(self): """main loop, which executes commands""" - convert = self._checkVersion() #returns None or current version + convert = self._checkVersion() #: returns None or current version self.conn = sqlite3.connect("files.db") chmod("files.db", 0600) - self.c = self.conn.cursor() #compatibility + self.c = self.conn.cursor() #: compatibility if convert is not None: self._convertDB(convert) diff --git a/pyload/manager/Account.py b/pyload/manager/Account.py index ea6f15e87..4e4a82aed 100644 --- a/pyload/manager/Account.py +++ b/pyload/manager/Account.py @@ -23,11 +23,11 @@ class AccountManager(object): self.lock = Lock() self.initPlugins() - self.saveAccounts() # save to add categories to conf + self.saveAccounts() #: save to add categories to conf def initPlugins(self): - self.accounts = {} # key = ( plugin ) + self.accounts = {} #: key = ( plugin ) self.plugins = {} self.initAccountPlugins() diff --git a/pyload/manager/Captcha.py b/pyload/manager/Captcha.py index 0814cf78a..4a7582d65 100644 --- a/pyload/manager/Captcha.py +++ b/pyload/manager/Captcha.py @@ -54,7 +54,7 @@ class CaptchaManager(object): cli = self.core.isClientConnected() if cli: #: client connected -> should solve the captcha - task.setWaiting(timeout) #wait 50 sec for response + task.setWaiting(timeout) #: wait 50 sec for response for plugin in self.core.addonManager.activePlugins(): try: diff --git a/pyload/manager/Remote.py b/pyload/manager/Remote.py index 4fdb36fc2..a27667070 100644 --- a/pyload/manager/Remote.py +++ b/pyload/manager/Remote.py @@ -62,8 +62,8 @@ class RemoteManager(object): def startBackends(self): - host = self.core.config["remote"]["listenaddr"] - port = self.core.config["remote"]["port"] + host = self.core.config.get("remote", "listenaddr") + port = self.core.config.get("remote", "port") for b in self.available: klass = getattr(__import__("pyload.remote.%s" % b, globals(), locals(), [b], -1), b) diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index fb302ef0a..015bc9ab1 100644 --- a/pyload/manager/Thread.py +++ b/pyload/manager/Thread.py @@ -150,7 +150,7 @@ class ThreadManager(object): def tryReconnect(self): """checks if reconnect needed""" - if not (self.core.config["reconnect"]["activated"] and self.core.api.isTimeReconnect()): + if not (self.core.config.get("reconnect", "activated") and self.core.api.isTimeReconnect()): return False active = [x.active.plugin.wantReconnect and x.active.plugin.waiting for x in self.threads if x.active] @@ -158,11 +158,11 @@ class ThreadManager(object): if not (0 < active.count(True) == len(active)): return False - if not exists(self.core.config['reconnect']['method']): - if exists(join(pypath, self.core.config['reconnect']['method'])): - self.core.config['reconnect']['method'] = join(pypath, self.core.config['reconnect']['method']) + if not exists(self.core.config.get("reconnect", "method")): + if exists(join(pypath, self.core.config.get("reconnect", "method"))): + self.core.config['reconnect']['method'] = join(pypath, self.core.config.get("reconnect", "method")) else: - self.core.config["reconnect"]["activated"] = False + self.core.config['reconnect']['activated'] = False self.core.log.warning(_("Reconnect script not found!")) return @@ -181,10 +181,10 @@ class ThreadManager(object): self.core.log.debug("Old IP: %s" % ip) try: - reconn = Popen(self.core.config['reconnect']['method'], bufsize=-1, shell=True) # , stdout=subprocess.PIPE) + reconn = Popen(self.core.config.get("reconnect", "method"), bufsize=-1, shell=True) # , stdout=subprocess.PIPE) except Exception: self.core.log.warning(_("Failed executing reconnect script!")) - self.core.config["reconnect"]["activated"] = False + self.core.config['reconnect']['activated'] = False self.reconnecting.clear() if self.core.debug: print_exc() @@ -278,8 +278,8 @@ class ThreadManager(object): return if job.plugin.getPluginType() == "hoster": - spaceLeft = freeSpace(self.core.config["general"]["download_folder"]) / 1024 / 1024 - if spaceLeft < self.core.config["general"]["min_free_space"]: + spaceLeft = freeSpace(self.core.config.get("general", "download_folder")) / 1024 / 1024 + if spaceLeft < self.core.config.get("general", "min_free_space"): self.core.log.warning(_("Not enough space left on device")) self.pause = True diff --git a/pyload/manager/thread/Plugin.py b/pyload/manager/thread/Plugin.py index 658ce4550..08a2664da 100644 --- a/pyload/manager/thread/Plugin.py +++ b/pyload/manager/thread/Plugin.py @@ -28,7 +28,7 @@ class PluginThread(Thread): """Constructor""" Thread.__init__(self) self.setDaemon(True) - self.m = manager #thread manager + self.m = manager #: thread manager def writeDebugReport(self, pyfile): @@ -52,7 +52,7 @@ class PluginThread(Thread): pass info = zipfile.ZipInfo(fs_join(pyfile.pluginname, "debug_Report.txt"), gmtime()) - info.external_attr = 0644 << 16L # change permissions + info.external_attr = 0644 << 16L #: change permissions zip.writestr(info, dump) zip.close() @@ -95,7 +95,7 @@ class PluginThread(Thread): del frame - del stack #delete it just to be sure... + del stack #: delete it just to be sure... dump += "\n\nPLUGIN OBJECT DUMP: \n\n" diff --git a/pyload/manager/thread/Server.py b/pyload/manager/thread/Server.py index b724ad2f9..990325f5d 100644 --- a/pyload/manager/thread/Server.py +++ b/pyload/manager/thread/Server.py @@ -20,12 +20,12 @@ class WebServer(threading.Thread): self.core = pycore core = pycore self.running = True - self.server = pycore.config['webui']['server'] - self.https = pycore.config['webui']['https'] - self.cert = pycore.config["ssl"]["cert"] - self.key = pycore.config["ssl"]["key"] - self.host = pycore.config['webui']['host'] - self.port = pycore.config['webui']['port'] + self.server = pycore.config.get("webui", "server") + self.https = pycore.config.get("webui", "https") + self.cert = pycore.config.get("ssl", "cert") + self.key = pycore.config.get("ssl", "key") + self.host = pycore.config.get("webui", "host") + self.port = pycore.config.get("webui", "port") self.setDaemon(True) @@ -103,7 +103,7 @@ class WebServer(threading.Thread): try: webinterface.run_fcgi(host=self.host, port=self.port) - except ValueError: #@TODO: Fix https://github.com/pyload/pyload/issues/1145 + except ValueError: #@TODO: Fix https://github.com/pyload/pyload/issues/1145 pass diff --git a/pyload/network/Browser.py b/pyload/network/Browser.py index 61bf523ab..fab7454f3 100644 --- a/pyload/network/Browser.py +++ b/pyload/network/Browser.py @@ -13,10 +13,10 @@ class Browser(object): def __init__(self, bucket=None, options={}): self.log = getLogger("log") - self.options = options #holds pycurl options + self.options = options #: holds pycurl options self.bucket = bucket - self.cj = None # needs to be setted later + self.cj = None #: needs to be setted later self._size = 0 self.renewHTTPRequest() @@ -119,7 +119,7 @@ class Browser(object): :param pwd: string, user:password """ self.options["auth"] = pwd - self.renewHTTPRequest() #we need a new request + self.renewHTTPRequest() #: we need a new request def removeAuth(self): diff --git a/pyload/network/Bucket.py b/pyload/network/Bucket.py index 408a1e240..5f8260384 100644 --- a/pyload/network/Bucket.py +++ b/pyload/network/Bucket.py @@ -10,7 +10,7 @@ MIN_RATE = 10240 #: 10kb minimum rate class Bucket(object): def __init__(self): - self.rate = 0 # bytes per second, maximum targeted throughput + self.rate = 0 #: bytes per second, maximum targeted throughput self.tokens = 0 self.timestamp = time() self.lock = Lock() diff --git a/pyload/network/HTTPChunk.py b/pyload/network/HTTPChunk.py index c11ad9e3c..82e1ca76e 100644 --- a/pyload/network/HTTPChunk.py +++ b/pyload/network/HTTPChunk.py @@ -86,7 +86,7 @@ class ChunkInfo(object): ci.loaded = True ci.setSize(size) while True: - if not fh.readline(): #skip line + if not fh.readline(): #: skip line break name = fh.readline()[1:-1] range = fh.readline()[1:-1] @@ -122,8 +122,8 @@ class HTTPChunk(HTTPRequest): def __init__(self, id, parent, range=None, resume=False): self.id = id - self.p = parent # HTTPDownload instance - self.range = range # tuple (start, end) + self.p = parent #: HTTPDownload instance + self.range = range #: tuple (start, end) self.resume = resume self.log = parent.log @@ -134,14 +134,14 @@ class HTTPChunk(HTTPRequest): self.c = pycurl.Curl() self.header = "" - self.headerParsed = False #indicates if the header has been processed + self.headerParsed = False #: indicates if the header has been processed - self.fp = None #file handle + self.fp = None #: file handle self.initHandle() self.setInterface(self.p.options) - self.BOMChecked = False # check and remove byte order mark + self.BOMChecked = False #: check and remove byte order mark self.rep = None @@ -175,10 +175,10 @@ class HTTPChunk(HTTPRequest): self.arrived = stat(fs_name).st_size if self.range: - #do nothing if chunk already finished + # do nothing if chunk already finished if self.arrived + self.range[0] >= self.range[1]: return None - if self.id == len(self.p.info.chunks) - 1: #as last chunk dont set end range, so we get everything + if self.id == len(self.p.info.chunks) - 1: #: as last chunk dont set end range, so we get everything range = "%i-" % (self.arrived + self.range[0]) else: range = "%i-%i" % (self.arrived + self.range[0], min(self.range[1] + 1, self.p.size - 1)) @@ -191,7 +191,7 @@ class HTTPChunk(HTTPRequest): else: if self.range: - if self.id == len(self.p.info.chunks) - 1: # see above + if self.id == len(self.p.info.chunks) - 1: #: see above range = "%i-" % self.range[0] else: range = "%i-%i" % (self.range[0], min(self.range[1] + 1, self.p.size - 1)) @@ -249,7 +249,7 @@ class HTTPChunk(HTTPRequest): sleep(self.sleep) if self.range and self.arrived > self.size: - return 0 #close if we have enough data + return 0 #: close if we have enough data def parseHeader(self): @@ -300,8 +300,8 @@ class HTTPChunk(HTTPRequest): def flushFile(self): """ flush and close file """ self.fp.flush() - fsync(self.fp.fileno()) #make sure everything was written to disk - self.fp.close() #needs to be closed, or merging chunks will fail + fsync(self.fp.fileno()) #: make sure everything was written to disk + self.fp.close() #: needs to be closed, or merging chunks will fail def close(self): diff --git a/pyload/network/HTTPDownload.py b/pyload/network/HTTPDownload.py index 0580a6b90..32c165f82 100644 --- a/pyload/network/HTTPDownload.py +++ b/pyload/network/HTTPDownload.py @@ -34,7 +34,7 @@ class HTTPDownload(object): self.abort = False self.size = 0 - self.nameDisposition = None #will be parsed from content disposition + self.nameDisposition = None #: will be parsed from content disposition self.chunks = [] @@ -42,7 +42,7 @@ class HTTPDownload(object): try: self.info = ChunkInfo.load(filename) - self.info.resume = True #resume is only possible with valid info file + self.info.resume = True #: resume is only possible with valid info file self.size = self.info.size self.infoSaved = True except IOError: @@ -77,18 +77,18 @@ class HTTPDownload(object): def _copyChunks(self): - init = fs_encode(self.info.getChunkName(0)) #initial chunk name + init = fs_encode(self.info.getChunkName(0)) #: initial chunk name if self.info.getCount() > 1: - fo = open(init, "rb+") #first chunkfile + fo = open(init, "rb+") #: first chunkfile for i in range(1, self.info.getCount()): #input file fo.seek( - self.info.getChunkRange(i - 1)[1] + 1) #seek to beginning of chunk, to get rid of overlapping chunks + self.info.getChunkRange(i - 1)[1] + 1) #: seek to beginning of chunk, to get rid of overlapping chunks fname = fs_encode("%s.chunk%d" % (self.filename, i)) fi = open(fname, "rb") buf = 32 * 1024 - while True: #copy in chunks, consumes less memory + while True: #: copy in chunks, consumes less memory data = fi.read(buf) if not data: break @@ -97,16 +97,16 @@ class HTTPDownload(object): if fo.tell() < self.info.getChunkRange(i)[1]: fo.close() remove(init) - self.info.remove() #there are probably invalid chunks + self.info.remove() #: there are probably invalid chunks raise Exception("Downloaded content was smaller than expected. Try to reduce download connections.") - remove(fname) #remove chunk + remove(fname) #: remove chunk fo.close() if self.nameDisposition and self.disposition: self.filename = fs_join(dirname(self.filename), self.nameDisposition) move(init, fs_encode(self.filename)) - self.info.remove() #remove info file + self.info.remove() #: remove info file def download(self, chunks=1, resume=False): @@ -141,12 +141,12 @@ class HTTPDownload(object): def _download(self, chunks, resume): if not resume: self.info.clear() - self.info.addChunk("%s.chunk0" % self.filename, (0, 0)) #create an initial entry + self.info.addChunk("%s.chunk0" % self.filename, (0, 0)) #: create an initial entry self.info.save() self.chunks = [] - init = HTTPChunk(0, self, None, resume) #initial chunk that will load complete file (if needed) + init = HTTPChunk(0, self, None, resume) #: initial chunk that will load complete file (if needed) self.chunks.append(init) self.m.add_handle(init.getHandle()) @@ -156,12 +156,12 @@ class HTTPDownload(object): chunksDone = set() # list of curl handles that are finished chunksCreated = False done = False - if self.info.getCount() is 0: # This is a resume, if we were chunked originally assume still can + if self.info.getCount() is 0: #: This is a resume, if we were chunked originally assume still can self.chunkSupport = False while 1: #need to create chunks - if not chunksCreated and self.chunkSupport and self.size: #will be setted later by first chunk + if not chunksCreated and self.chunkSupport and self.size: #: will be setted later by first chunk if not resume: self.info.setSize(self.size) @@ -197,12 +197,12 @@ class HTTPDownload(object): while lastFinishCheck + 0.5 < t: # list of failed curl handles failed = [] - ex = None # save only last exception, we can only raise one anyway + ex = None #: save only last exception, we can only raise one anyway num_q, ok_list, err_list = self.m.info_read() for c in ok_list: chunk = self.findChunk(c) - try: # check if the header implies success, else add it to failed list + try: #: check if the header implies success, else add it to failed list chunk.verifyHeader() except BadHeader, e: self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(e))) @@ -221,7 +221,7 @@ class HTTPDownload(object): self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(ex))) continue - try: # check if the header implies success, else add it to failed list + try: #: check if the header implies success, else add it to failed list chunk.verifyHeader() except BadHeader, e: self.log.debug("Chunk %d failed: %s" % (chunk.id + 1, str(e))) @@ -229,7 +229,7 @@ class HTTPDownload(object): ex = e else: chunksDone.add(curl) - if not num_q: # no more infos to get + if not num_q: #: no more infos to get # check if init is not finished so we reset download connections # note that other chunks are closed and downloaded with init too @@ -261,7 +261,7 @@ class HTTPDownload(object): break if done: - break #all chunks loaded + break #: all chunks loaded # calc speed once per second, averaging over 3 seconds if lastTimeCheck + 1 < t: @@ -278,11 +278,11 @@ class HTTPDownload(object): if self.abort: raise Abort - # sleep(0.003) #supress busy waiting - limits dl speed to (1 / x) * buffersize + # sleep(0.003) #: supress busy waiting - limits dl speed to (1 / x) * buffersize self.m.select(1) for chunk in self.chunks: - chunk.flushFile() #make sure downloads are written to disk + chunk.flushFile() #: make sure downloads are written to disk self._copyChunks() diff --git a/pyload/network/RequestFactory.py b/pyload/network/RequestFactory.py index 5f8e7e206..a80882088 100644 --- a/pyload/network/RequestFactory.py +++ b/pyload/network/RequestFactory.py @@ -21,7 +21,7 @@ class RequestFactory(object): def iface(self): - return self.core.config["download"]["interface"] + return self.core.config.get("download", "interface") def getRequest(self, pluginName, account=None, type="HTTP"): @@ -45,7 +45,7 @@ class RequestFactory(object): def getHTTPRequest(self, **kwargs): """ returns a http request, dont forget to close it ! """ options = self.getOptions() - options.update(kwargs) # submit kwargs as additional options + options.update(kwargs) #: submit kwargs as additional options return HTTPRequest(CookieJar(None), options) @@ -82,26 +82,26 @@ class RequestFactory(object): def getProxies(self): """ returns a proxy list for the request classes """ - if not self.core.config["proxy"]["proxy"]: + if not self.core.config.get("proxy", "proxy"): return {} else: type = "http" - setting = self.core.config["proxy"]["type"].lower() + setting = self.core.config.get("proxy", "type").lower() if setting == "socks4": type = "socks4" elif setting == "socks5": type = "socks5" username = None - if self.core.config["proxy"]["username"] and self.core.config["proxy"]["username"].lower() != "none": - username = self.core.config["proxy"]["username"] + if self.core.config.get("proxy", "username") and self.core.config.get("proxy", "username").lower() != "none": + username = self.core.config.get("proxy", "username") pw = None - if self.core.config["proxy"]["password"] and self.core.config["proxy"]["password"].lower() != "none": - pw = self.core.config["proxy"]["password"] + if self.core.config.get("proxy", "password") and self.core.config.get("proxy", "password").lower() != "none": + pw = self.core.config.get("proxy", "password") return { "type": type, - "address": self.core.config["proxy"]["address"], - "port": self.core.config["proxy"]["port"], + "address": self.core.config.get("proxy", "address"), + "port": self.core.config.get("proxy", "port"), "username": username, "password": pw, } @@ -111,15 +111,15 @@ class RequestFactory(object): """returns options needed for pycurl""" return {"interface": self.iface(), "proxies": self.getProxies(), - "ipv6": self.core.config["download"]["ipv6"]} + "ipv6": self.core.config.get("download", "ipv6")} def updateBucket(self): """ set values in the bucket according to settings""" - if not self.core.config["download"]["limit_speed"]: + if not self.core.config.get("download", "limit_speed"): self.bucket.setRate(-1) else: - self.bucket.setRate(self.core.config["download"]["max_speed"] * 1024) + self.bucket.setRate(self.core.config.get("download", "max_speed") * 1024) # needs pyreq in global namespace def getURL(*args, **kwargs): diff --git a/pyload/plugin/Container.py b/pyload/plugin/Container.py index 87d75976f..e8e42bb2b 100644 --- a/pyload/plugin/Container.py +++ b/pyload/plugin/Container.py @@ -45,7 +45,7 @@ class Container(Crypter): if self.pyfile.url.startswith("http"): self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] content = self.load(self.pyfile.url) - self.pyfile.url = fs_join(self.core.config['general']['download_folder'], self.pyfile.name) + self.pyfile.url = fs_join(self.core.config.get("general", "download_folder"), self.pyfile.name) try: with open(self.pyfile.url, "wb") as f: f.write(content) diff --git a/pyload/plugin/Crypter.py b/pyload/plugin/Crypter.py index aa9966ab4..3c1413f09 100644 --- a/pyload/plugin/Crypter.py +++ b/pyload/plugin/Crypter.py @@ -12,7 +12,7 @@ class Crypter(Plugin): __version = "0.05" __pattern = r'^unmatchable$' - __config = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] + __config = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config.get("general", "folder_per_package") ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description = """Base decrypter plugin""" @@ -42,7 +42,7 @@ class Crypter(Plugin): self.generatePackages() elif not self.packages: - self.error(_("No link extracted"), "decrypt") + self.error(_("No link grabbed"), "decrypt") self.createPackages() @@ -65,7 +65,7 @@ class Crypter(Plugin): package_password = self.pyfile.package().password package_queue = self.pyfile.package().queue - folder_per_package = self.core.config['general']['folder_per_package'] + folder_per_package = self.core.config.get("general", "folder_per_package") try: use_subfolder = self.getConfig('use_subfolder') except Exception: diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py index 3ccf94f34..c18e16643 100644 --- a/pyload/plugin/Plugin.py +++ b/pyload/plugin/Plugin.py @@ -252,8 +252,8 @@ class Plugin(Base): def getChunkCount(self): if self.chunkLimit <= 0: - return self.core.config['download']['chunks'] - return min(self.core.config['download']['chunks'], self.chunkLimit) + return self.core.config.get("download", "chunks") + return min(self.core.config.get("download", "chunks"), self.chunkLimit) def __call__(self): @@ -616,17 +616,17 @@ class Plugin(Base): if disposition: self.pyfile.name = urlparse.urlparse(url).path.split('/')[-1] or self.pyfile.name - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") location = fs_join(download_folder, self.pyfile.package().folder) if not exists(location): try: - makedirs(location, int(self.core.config['permission']['folder'], 8)) + makedirs(location, int(self.core.config.get("permission", "folder"), 8)) - if self.core.config['permission']['change_dl'] and os.name != "nt": - uid = getpwnam(self.core.config['permission']['user'])[2] - gid = getgrnam(self.core.config['permission']['group'])[2] + if self.core.config.get("permission", "change_dl") and os.name != "nt": + uid = getpwnam(self.core.config.get("permission", "user"))[2] + gid = getgrnam(self.core.config.get("permission", "group"))[2] chown(location, uid, gid) except Exception, e: @@ -657,16 +657,16 @@ class Plugin(Base): fs_filename = fs_encode(filename) - if self.core.config['permission']['change_file']: + if self.core.config.get("permission", "change_file"): try: - chmod(fs_filename, int(self.core.config['permission']['file'], 8)) + chmod(fs_filename, int(self.core.config.get("permission", "file"), 8)) except Exception, e: self.logWarning(_("Setting file mode failed"), e) - if self.core.config['permission']['change_dl'] and os.name != "nt": + if self.core.config.get("permission", "change_dl") and os.name != "nt": try: - uid = getpwnam(self.core.config['permission']['user'])[2] - gid = getgrnam(self.core.config['permission']['group'])[2] + uid = getpwnam(self.core.config.get("permission", "user"))[2] + gid = getgrnam(self.core.config.get("permission", "group"))[2] chown(fs_filename, uid, gid) except Exception, e: @@ -740,10 +740,10 @@ class Plugin(Base): elif pyfile.status in (5, 7) and starting: # a download is waiting/starting and was appenrently started before raise SkipDownload(pyfile.pluginname) - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") location = fs_join(download_folder, pack.folder, self.pyfile.name) - if starting and self.core.config['download']['skip_existing'] and exists(location): + if starting and self.core.config.get("download", "skip_existing") and exists(location): size = os.stat(location).st_size if size >= self.pyfile.size: raise SkipDownload("File exists") diff --git a/pyload/plugin/account/FastixRu.py b/pyload/plugin/account/FastixRu.py index fbb635437..ead4e63aa 100644 --- a/pyload/plugin/account/FastixRu.py +++ b/pyload/plugin/account/FastixRu.py @@ -18,13 +18,14 @@ class FastixRu(Account): data = self.getAccountData(user) html = json_loads(req.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"})) - points = html['points'] - kb = float(points) * 1024 ** 2 / 1000 + points = html['points'] + trafficleft = float(points) * 1024 ** 2 / 1000 if points > 0: - account_info = {"validuntil": -1, "trafficleft": kb} + account_info = {"validuntil": -1, "trafficleft": trafficleft} else: account_info = {"validuntil": None, "trafficleft": None, "premium": False} + return account_info diff --git a/pyload/plugin/account/NoPremiumPl.py b/pyload/plugin/account/NoPremiumPl.py index ac0e64cd4..d825b38ed 100644 --- a/pyload/plugin/account/NoPremiumPl.py +++ b/pyload/plugin/account/NoPremiumPl.py @@ -46,7 +46,7 @@ class NoPremiumPl(Account): if "expire" in result.keys() and result["expire"]: premium = True valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) - traffic_left = result["balance"] * 1024 + traffic_left = result["balance"] * 2 ** 20 return ({ "validuntil": valid_untill, diff --git a/pyload/plugin/account/OboomCom.py b/pyload/plugin/account/OboomCom.py index 17d81428c..68e083d75 100644 --- a/pyload/plugin/account/OboomCom.py +++ b/pyload/plugin/account/OboomCom.py @@ -64,8 +64,8 @@ class OboomCom(Account): traffic = userData['traffic'] - trafficLeft = traffic['current'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - maxTraffic = traffic['max'] / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficLeft = traffic['current'] + maxTraffic = traffic['max'] session = accountData['session'] diff --git a/pyload/plugin/account/PremiumTo.py b/pyload/plugin/account/PremiumTo.py index fcd856ea7..586ddf635 100644 --- a/pyload/plugin/account/PremiumTo.py +++ b/pyload/plugin/account/PremiumTo.py @@ -20,7 +20,7 @@ class PremiumTo(Account): get={'username': self.username, 'password': self.password}) if "wrong username" not in traffic: - trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft = sum(map(float, traffic.split(';'))) return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} else: return {'premium': False, 'trafficleft': None, 'validuntil': None} diff --git a/pyload/plugin/account/PremiumizeMe.py b/pyload/plugin/account/PremiumizeMe.py index 7a701d03b..06e6ffb98 100644 --- a/pyload/plugin/account/PremiumizeMe.py +++ b/pyload/plugin/account/PremiumizeMe.py @@ -22,7 +22,7 @@ class PremiumizeMe(Account): # Parse account info account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 + "trafficleft": max(0, status['result']['trafficleft_bytes'])} if status['result']['type'] == 'free': account_info['premium'] = False diff --git a/pyload/plugin/account/RapidgatorNet.py b/pyload/plugin/account/RapidgatorNet.py index 17b615a0b..729635037 100644 --- a/pyload/plugin/account/RapidgatorNet.py +++ b/pyload/plugin/account/RapidgatorNet.py @@ -38,7 +38,7 @@ class RapidgatorNet(Account): self.scheduleRefresh(user, json['response']['reset_in']) validuntil = json['response']['expire_date'] - trafficleft = float(json['response']['traffic_left']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft = float(json['response']['traffic_left']) premium = True else: self.logError(json['response_details']) diff --git a/pyload/plugin/account/ShareonlineBiz.py b/pyload/plugin/account/ShareonlineBiz.py index a27d52736..06b2818c9 100644 --- a/pyload/plugin/account/ShareonlineBiz.py +++ b/pyload/plugin/account/ShareonlineBiz.py @@ -27,7 +27,7 @@ class ShareonlineBiz(Account): premium = False validuntil = None trafficleft = -1 - maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB + maxtraffic = 100 * 2 ** 30 #: 100 GB api = {} for line in self.api_response(user, req).splitlines(): @@ -48,9 +48,6 @@ class ShareonlineBiz(Account): maxtraffic = max(maxtraffic, traffic) trafficleft = maxtraffic - traffic - maxtraffic /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 - trafficleft /= 1024 #@TODO: Remove `/ 1024` in 0.4.10 - return {'premium' : premium, 'validuntil' : validuntil, 'trafficleft': trafficleft, diff --git a/pyload/plugin/account/SimplyPremiumCom.py b/pyload/plugin/account/SimplyPremiumCom.py index 92e4edbb9..2547dad56 100644 --- a/pyload/plugin/account/SimplyPremiumCom.py +++ b/pyload/plugin/account/SimplyPremiumCom.py @@ -32,7 +32,7 @@ class SimplyPremiumCom(Account): validuntil = float(json_data['result']['timeend']) if 'remain_traffic' in json_data['result'] and json_data['result']['remain_traffic']: - trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft = float(json_data['result']['remain_traffic']) return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} diff --git a/pyload/plugin/account/UnrestrictLi.py b/pyload/plugin/account/UnrestrictLi.py index 8d3071580..d57b998ca 100644 --- a/pyload/plugin/account/UnrestrictLi.py +++ b/pyload/plugin/account/UnrestrictLi.py @@ -23,7 +23,7 @@ class UnrestrictLi(Account): return {"premium": False} validuntil = json_data['result']['expires'] - trafficleft = float(json_data['result']['traffic'] / 1024) #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft = float(json_data['result']['traffic']) return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} diff --git a/pyload/plugin/account/UploadedTo.py b/pyload/plugin/account/UploadedTo.py index 13b0f3112..61765faf8 100644 --- a/pyload/plugin/account/UploadedTo.py +++ b/pyload/plugin/account/UploadedTo.py @@ -49,11 +49,7 @@ class UploadedTo(Account): size = traffic['S'].replace('.', '') unit = traffic['U'].lower() - if unit.startswith('t'): #@NOTE: Remove in 0.4.10 - trafficleft = float(size.replace(',', '.')) / 1024 - trafficleft *= 1 << 40 - else: - trafficleft = self.parseTraffic(size + unit) + trafficleft = self.parseTraffic(size + unit) return {'validuntil' : validuntil, 'trafficleft': trafficleft, diff --git a/pyload/plugin/account/ZeveraCom.py b/pyload/plugin/account/ZeveraCom.py index 9be032ca1..25c2c5512 100644 --- a/pyload/plugin/account/ZeveraCom.py +++ b/pyload/plugin/account/ZeveraCom.py @@ -41,7 +41,7 @@ class ZeveraCom(Account): if "No trafic" not in api and api['endsubscriptiondate'] != "Expired!": validuntil = time.mktime(time.strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) - trafficleft = float(api['availabletodaytraffic']) * 1024 if api['orondaytrafficlimit'] != '0' else -1 + trafficleft = float(api['availabletodaytraffic']) * 2 ** 20 if api['orondaytrafficlimit'] != '0' else -1 premium = True return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} diff --git a/pyload/plugin/addon/AntiVirus.py b/pyload/plugin/addon/AntiVirus.py index 3866014ee..87780e337 100644 --- a/pyload/plugin/addon/AntiVirus.py +++ b/pyload/plugin/addon/AntiVirus.py @@ -28,8 +28,6 @@ class AntiVirus(Addon): def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - try: import send2trash diff --git a/pyload/plugin/addon/Checksum.py b/pyload/plugin/addon/Checksum.py index 53b9b4e9f..ed50b0f5e 100644 --- a/pyload/plugin/addon/Checksum.py +++ b/pyload/plugin/addon/Checksum.py @@ -105,7 +105,7 @@ class Checksum(Addon): self.checkFailed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.config['general']['download_folder'] + #download_folder = self.config.get("general", "download_folder") #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not isfile(local_file): @@ -166,7 +166,7 @@ class Checksum(Addon): def packageFinished(self, pypack): - download_folder = fs_join(self.config['general']['download_folder'], pypack.folder, "") + download_folder = fs_join(self.config.get("general", "download_folder"), pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = splitext(link['name'])[1][1:].lower() diff --git a/pyload/plugin/addon/ClickNLoad.py b/pyload/plugin/addon/ClickNLoad.py index b6448598a..4e1be807d 100644 --- a/pyload/plugin/addon/ClickNLoad.py +++ b/pyload/plugin/addon/ClickNLoad.py @@ -37,11 +37,11 @@ class ClickNLoad(Addon): def activate(self): - if not self.core.config['webui']['activated']: + if not self.core.config.get("webui", "activated"): return ip = "" if self.getConfig('extern') else "127.0.0.1" - webport = self.core.config['webui']['port'] + webport = self.core.config.get("webui", "port") cnlport = self.getConfig('port') self.proxy(ip, webport, cnlport) diff --git a/pyload/plugin/addon/ExternalScripts.py b/pyload/plugin/addon/ExternalScripts.py index 75c9ae810..341dd6dcd 100644 --- a/pyload/plugin/addon/ExternalScripts.py +++ b/pyload/plugin/addon/ExternalScripts.py @@ -30,7 +30,7 @@ class ExternalScripts(Addon): def setup(self): - self.info = {'oldip': None} + self.info['oldip'] = None self.scripts = {} folders = ["pyload_start", "pyload_restart", "pyload_stop", @@ -38,7 +38,7 @@ class ExternalScripts(Addon): "download_preparing", "download_failed", "download_finished", "archive_extract_failed", "archive_extracted", "package_finished", "package_deleted", "package_extract_failed", "package_extracted", - "all_downloads_processed", "all_downloads_finished", # @TODO: Invert `all_downloads_processed`, `all_downloads_finished` order in 0.4.10 + "all_downloads_processed", "all_downloads_finished", #@TODO: Invert `all_downloads_processed`, `all_downloads_finished` order in 0.4.10 "all_archives_extracted", "all_archives_processed"] for folder in folders: @@ -84,7 +84,7 @@ class ExternalScripts(Addon): self.logDebug("Executing: %s" % os.path.abspath(script), "Args: " + ' '.join(cmd_args)) - p = subprocess.Popen(cmd, bufsize=-1) # @NOTE: output goes to pyload + p = subprocess.Popen(cmd, bufsize=-1) #@NOTE: output goes to pyload if self.getConfig('waitend'): p.communicate() @@ -113,7 +113,7 @@ class ExternalScripts(Addon): def afterReconnecting(self, ip): for script in self.scripts['after_reconnect']: - self.callScript(script, ip, self.info['oldip']) # @TODO: Use built-in oldip in 0.4.10 + self.callScript(script, ip, self.info['oldip']) #@TODO: Use built-in oldip in 0.4.10 def downloadPreparing(self, pyfile): @@ -122,10 +122,10 @@ class ExternalScripts(Addon): def downloadFailed(self, pyfile): - if self.core.config['general']['folder_per_package']: - download_folder = fs_join(self.core.config['general']['download_folder'], pyfile.package().folder) + if self.core.config.get("general", "folder_per_package"): + download_folder = fs_join(self.core.config.get("general", "download_folder"), pyfile.package().folder) else: - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") for script in self.scripts['download_failed']: file = fs_join(download_folder, pyfile.name) @@ -133,10 +133,10 @@ class ExternalScripts(Addon): def downloadFinished(self, pyfile): - if self.core.config['general']['folder_per_package']: - download_folder = fs_join(self.core.config['general']['download_folder'], pyfile.package().folder) + if self.core.config.get("general", "folder_per_package"): + download_folder = fs_join(self.core.config.get("general", "download_folder"), pyfile.package().folder) else: - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") for script in self.scripts['download_finished']: file = fs_join(download_folder, pyfile.name) @@ -154,10 +154,10 @@ class ExternalScripts(Addon): def packageFinished(self, pypack): - if self.core.config['general']['folder_per_package']: - download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder) + if self.core.config.get("general", "folder_per_package"): + download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder) else: - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") for script in self.scripts['package_finished']: self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password) @@ -166,30 +166,30 @@ class ExternalScripts(Addon): def packageDeleted(self, pid): pack = self.core.api.getPackageInfo(pid) - if self.core.config['general']['folder_per_package']: - download_folder = fs_join(self.core.config['general']['download_folder'], pack.folder) + if self.core.config.get("general", "folder_per_package"): + download_folder = fs_join(self.core.config.get("general", "download_folder"), pack.folder) else: - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") for script in self.scripts['package_deleted']: self.callScript(script, pack.id, pack.name, download_folder, pack.password) def package_extract_failed(self, pypack): - if self.core.config['general']['folder_per_package']: - download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder) + if self.core.config.get("general", "folder_per_package"): + download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder) else: - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") for script in self.scripts['package_extract_failed']: self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password) def package_extracted(self, pypack): - if self.core.config['general']['folder_per_package']: - download_folder = fs_join(self.core.config['general']['download_folder'], pypack.folder) + if self.core.config.get("general", "folder_per_package"): + download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder) else: - download_folder = self.core.config['general']['download_folder'] + download_folder = self.core.config.get("general", "download_folder") for script in self.scripts['package_extracted']: self.callScript(script, pypack.id, pypack.name, download_folder) diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index bc1b06306..a106d22ab 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -198,11 +198,11 @@ class ExtractArchive(Addon): while packages: if self.lastPackage: #: called from allDownloadsProcessed self.lastPackage = False - if self.extract(packages, thread): # @NOTE: check only if all gone fine, no failed reporting for now + if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now self.manager.dispatchEvent("all_archives_extracted") self.manager.dispatchEvent("all_archives_processed") else: - if self.extract(packages, thread): # @NOTE: check only if all gone fine, no failed reporting for now + if self.extract(packages, thread): #@NOTE: check only if all gone fine, no failed reporting for now pass packages = self.queue.get() #: check for packages added during extraction @@ -234,7 +234,7 @@ class ExtractArchive(Addon): @Expose - def extract(self, ids, thread=None): # @TODO: Use pypack, not pid to improve method usability + def extract(self, ids, thread=None): #@TODO: Use pypack, not pid to improve method usability if not ids: return False @@ -264,7 +264,7 @@ class ExtractArchive(Addon): # reload from txt file self.reloadPasswords() - download_folder = self.config['general']['download_folder'] + download_folder = self.config.get("general", "download_folder") # iterate packages -> extractors -> targets for pid in ids: @@ -551,16 +551,16 @@ class ExtractArchive(Addon): continue try: - if self.config['permission']['change_file']: + if self.config.get("permission", "change_file"): if os.path.isfile(f): - os.chmod(f, int(self.config['permission']['file'], 8)) + os.chmod(f, int(self.config.get("permission", "file"), 8)) elif os.path.isdir(f): - os.chmod(f, int(self.config['permission']['folder'], 8)) + os.chmod(f, int(self.config.get("permission", "folder"), 8)) - if self.config['permission']['change_dl'] and os.name != "nt": - uid = getpwnam(self.config['permission']['user'])[2] - gid = getgrnam(self.config['permission']['group'])[2] + if self.config.get("permission", "change_dl") and os.name != "nt": + uid = getpwnam(self.config.get("permission", "user"))[2] + gid = getgrnam(self.config.get("permission", "group"))[2] os.chown(f, uid, gid) except Exception, e: diff --git a/pyload/plugin/addon/MergeFiles.py b/pyload/plugin/addon/MergeFiles.py index dfc5f41d4..4f95ef9d7 100644 --- a/pyload/plugin/addon/MergeFiles.py +++ b/pyload/plugin/addon/MergeFiles.py @@ -37,9 +37,9 @@ class MergeFiles(Addon): files[data['name'][:-4]].sort() fid_dict[data['name']] = fid - download_folder = self.config['general']['download_folder'] + download_folder = self.config.get("general", "download_folder") - if self.config['general']['folder_per_package']: + if self.config.get("general", "folder_per_package"): download_folder = fs_join(download_folder, pack.folder) for name, file_list in files.iteritems(): diff --git a/pyload/plugin/addon/MultiHome.py b/pyload/plugin/addon/MultiHome.py index 057764a1e..bca6493db 100644 --- a/pyload/plugin/addon/MultiHome.py +++ b/pyload/plugin/addon/MultiHome.py @@ -24,7 +24,7 @@ class MultiHome(Addon): self.parseInterfaces(self.getConfig('interfaces').split(";")) if not self.interfaces: - self.parseInterfaces([self.config['download']['interface']]) + self.parseInterfaces([self.config.get("download", "interface")]) self.setConfig("interfaces", self.toConfig()) diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py index 60fc71d0a..cf8349e79 100644 --- a/pyload/plugin/addon/UpdateManager.py +++ b/pyload/plugin/addon/UpdateManager.py @@ -30,7 +30,7 @@ def exists(path): class UpdateManager(Addon): __name = "UpdateManager" __type = "addon" - __version = "0.50" + __version = "0.51" __config = [("activated", "bool", "Activated", False), ("checkinterval", "int", "Check interval in hours", 8), @@ -50,6 +50,8 @@ class UpdateManager(Addon): SERVER_URL = "http://updatemanager.pyload.org" if release_status == 5 else None MIN_CHECK_INTERVAL = 3 * 60 * 60 #: 3 hours + event_list = ["allDownloadsProcessed"] + def activate(self): if self.checkonstart: @@ -69,6 +71,14 @@ class UpdateManager(Addon): else: self.checkonstart = False + self.do_restart = False + + + def allDownloadsProcessed(self): + if self.do_restart is True: + self.logWarning(_("Downloads are done, restarting pyLoad to reload the updated plugins")) + self.core.api.restart() + def periodical(self): if self.core.debug: @@ -129,7 +139,11 @@ class UpdateManager(Addon): self.core.api.pauseServer() if self._update() is 2 and self.getConfig('autorestart'): - self.core.api.restart() + if not self.core.api.statusDownloads(): + self.core.api.restart() + else: + self.do_restart = True + self.logWarning(_("Downloads are active, will restart once the download is done")) else: self.core.api.unpauseServer() @@ -208,7 +222,7 @@ class UpdateManager(Addon): for plugin in sorted(updatelist, key=itemgetter("type", "name")): filename = plugin['name'] - prefix = plugin['type'] + type = plugin['type'] version = plugin['version'] if filename.endswith(".pyc"): @@ -216,12 +230,6 @@ class UpdateManager(Addon): else: name = filename.replace(".py", "") - #@TODO: Remove in 0.4.10 - if prefix.endswith("s"): - type = prefix[:-1] - else: - type = prefix - plugins = getattr(self.core.pluginManager, "%sPlugins" % type) oldver = float(plugins[name]['version']) if name in plugins else None @@ -259,7 +267,7 @@ class UpdateManager(Addon): if self.core.pluginManager.reloadPlugins(updated): exitcode = 1 else: - self.logWarning(_("Restart pyLoad to reload the updated plugins")) + self.logWarning(_("pyLoad restart required to reload the updated plugins")) self.info['plugins'] = True exitcode = 2 diff --git a/pyload/plugin/addon/UserAgentSwitcher.py b/pyload/plugin/addon/UserAgentSwitcher.py index ec1640e63..31a2b763b 100644 --- a/pyload/plugin/addon/UserAgentSwitcher.py +++ b/pyload/plugin/addon/UserAgentSwitcher.py @@ -25,10 +25,6 @@ class UserAgentSwitcher(Addon): __authors = [("Walter Purcaro", "vuolter@gmail.com")] - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def downloadPreparing(self, pyfile): uar = self.getConfig('uar') uaf = fs_encode(self.getConfig('uaf')) diff --git a/pyload/plugin/container/CCF.py b/pyload/plugin/container/CCF.py index 12031989e..ef105d8a8 100644 --- a/pyload/plugin/container/CCF.py +++ b/pyload/plugin/container/CCF.py @@ -33,7 +33,7 @@ class CCF(Container): 'filename': "test.ccf", 'upload' : open(fs_filename, "rb")}).read() - download_folder = self.config['general']['download_folder'] + download_folder = self.config.get("general", "download_folder") dlc_file = fs_join(download_folder, "tmp_%s.dlc" % pyfile.name) try: diff --git a/pyload/plugin/crypter/DailymotionComFolder.py b/pyload/plugin/crypter/DailymotionComFolder.py index 2fdb1ec8e..fe173fe82 100644 --- a/pyload/plugin/crypter/DailymotionComFolder.py +++ b/pyload/plugin/crypter/DailymotionComFolder.py @@ -101,6 +101,6 @@ class DailymotionComFolder(Crypter): for p_id, p_name, p_owner in playlists: p_videos = self.getVideos(p_id) - p_folder = fs_join(self.config['general']['download_folder'], p_owner, p_name) + p_folder = fs_join(self.config.get("general", "download_folder"), p_owner, p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! diff --git a/pyload/plugin/crypter/MegaCoNz.py b/pyload/plugin/crypter/MegaCoNz.py index 2ab7ec55c..c66b3f112 100644 --- a/pyload/plugin/crypter/MegaCoNz.py +++ b/pyload/plugin/crypter/MegaCoNz.py @@ -27,6 +27,3 @@ class MegaCoNz(Crypter): url = "https://mega.co.nz/#F!%s!%s" % re.match(self.__pattern, pyfile.url).groups() self.html = self.load("http://rapidgen.org/linkfinder", post={'linklisturl': url}) self.urls = re.findall(r'(https://mega.co.nz/#N!.+?)<', self.html) - - if not self.urls: #@TODO: Remove in 0.4.10 - self.fail(_("No link grabbed")) diff --git a/pyload/plugin/crypter/RelinkUs.py b/pyload/plugin/crypter/RelinkUs.py index e7fb7ed06..6296e9f40 100644 --- a/pyload/plugin/crypter/RelinkUs.py +++ b/pyload/plugin/crypter/RelinkUs.py @@ -219,7 +219,7 @@ class RelinkUs(Crypter): try: dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" - dlc_filepath = fs_join(self.config['general']['download_folder'], dlc_filename) + dlc_filepath = fs_join(self.config.get("general", "download_folder"), dlc_filename) with open(dlc_filepath, "wb") as f: f.write(dlc) package_links.append(dlc_filepath) diff --git a/pyload/plugin/crypter/YoutubeComFolder.py b/pyload/plugin/crypter/YoutubeComFolder.py index da76e556b..84277207a 100644 --- a/pyload/plugin/crypter/YoutubeComFolder.py +++ b/pyload/plugin/crypter/YoutubeComFolder.py @@ -132,7 +132,7 @@ class YoutubeComFolder(Crypter): for p in playlists: p_name = p['title'] p_videos = self.getVideosId(p['id']) - p_folder = fs_join(self.config['general']['download_folder'], p['channelTitle'], p_name) + p_folder = fs_join(self.config.get("general", "download_folder"), p['channelTitle'], p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) if not p_videos: diff --git a/pyload/plugin/hoster/FilerNet.py b/pyload/plugin/hoster/FilerNet.py index f9b38e8cb..86a5809da 100644 --- a/pyload/plugin/hoster/FilerNet.py +++ b/pyload/plugin/hoster/FilerNet.py @@ -48,13 +48,9 @@ class FilerNet(SimpleHoster): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() - #@NOTE: Work-around for v0.4.9 just_header issue - #@TODO: Check for v0.4.10 - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': response, - 'hash': inputs['hash']}) - self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) + 'hash': inputs['hash']}, follow_location=False) if 'location' in self.req.http.header.lower(): self.link = re.search(r'location: (\S+)', self.req.http.header, re.I).group(1) diff --git a/pyload/plugin/hoster/FreakshareCom.py b/pyload/plugin/hoster/FreakshareCom.py index c5315cdc8..64d8f8308 100644 --- a/pyload/plugin/hoster/FreakshareCom.py +++ b/pyload/plugin/hoster/FreakshareCom.py @@ -130,7 +130,7 @@ class FreakshareCom(Hoster): if m: units = float(m.group(1).replace(",", "")) pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)] - size = int(units * 1024 ** pow) + size = int(units * (2 ** 20) ** pow) return size diff --git a/pyload/plugin/hoster/GigapetaCom.py b/pyload/plugin/hoster/GigapetaCom.py index adbdc2396..c524a0a7c 100644 --- a/pyload/plugin/hoster/GigapetaCom.py +++ b/pyload/plugin/hoster/GigapetaCom.py @@ -43,7 +43,7 @@ class GigapetaCom(SimpleHoster): m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: - self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1) break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() diff --git a/pyload/plugin/hoster/HostujeNet.py b/pyload/plugin/hoster/HostujeNet.py new file mode 100644 index 000000000..4dd5bb1c3 --- /dev/null +++ b/pyload/plugin/hoster/HostujeNet.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.internal.SimpleHoster import SimpleHoster + + +class HostujeNet(SimpleHoster): + __name__ = "HostujeNet" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'http://(?:www\.)?hostuje\.net/\w+' + + __description__ = """Hostuje.net hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("GammaC0de", None)] + + + NAME_PATTERN = r'<input type="hidden" name="name" value="(?P<N>.+?)">' + SIZE_PATTERN = r'<b>Rozmiar:</b> (?P<S>[\d.,]+) (?P<U>[\w^_]+)<br>' + OFFLINE_PATTERN = ur'Podany plik nie zostaÅ odnaleziony\.\.\.' + + + def setup(self): + self.multiDL = True + self.chunkLimit = 1 + + + def handleFree(self, pyfile): + m = re.search(r'<script src="([\w^_]+.php)"></script>', self.html) + if m: + jscript = self.load("http://hostuje.net/" + m.group(1)) + m = re.search(r"\('(\w+\.php\?i=\w+)'\);", jscript) + if m: + self.load("http://hostuje.net/" + m.group(1)) + else: + self.error(_("unexpected javascript format")) + else: + self.error(_("script not found")) + + action, inputs = self.parseHtmlForm(pyfile.url.replace(".", "\.").replace( "?", "\?")) + if not action: + self.error(_("form not found")) + + self.download(action, post=inputs) diff --git a/pyload/plugin/hoster/MegasharesCom.py b/pyload/plugin/hoster/MegasharesCom.py index 184be2fd6..ac7a81313 100644 --- a/pyload/plugin/hoster/MegasharesCom.py +++ b/pyload/plugin/hoster/MegasharesCom.py @@ -89,7 +89,7 @@ class MegasharesCom(SimpleHoster): self.fail(_("Passport not found")) self.logInfo(_("Download passport: %s") % m.group(1)) - data_left = float(m.group(2)) * 1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] + data_left = float(m.group(2)) * (2 ** 20) ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[m.group(3)] self.logInfo(_("Data left: %s %s (%d MB needed)") % (m.group(2), m.group(3), self.pyfile.size / 1048576)) if not data_left: diff --git a/pyload/plugin/hoster/QuickshareCz.py b/pyload/plugin/hoster/QuickshareCz.py index 6d6f21c71..3dd11f04a 100644 --- a/pyload/plugin/hoster/QuickshareCz.py +++ b/pyload/plugin/hoster/QuickshareCz.py @@ -65,7 +65,7 @@ class QuickshareCz(SimpleHoster): if m is None: self.fail(_("File not found")) - self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + self.link = m.group(1) self.logDebug("FREE URL2:" + self.link) # check errors diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py index 7031d0ab2..487c01576 100644 --- a/pyload/plugin/hoster/UploadedTo.py +++ b/pyload/plugin/hoster/UploadedTo.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster class UploadedTo(SimpleHoster): __name = "UploadedTo" __type = "hoster" - __version = "0.85" + __version = "0.86" __pattern = r'https?://(?:www\.)?(uploaded\.(to|net)|ul\.to)(/file/|/?\?id=|.*?&id=|/)(?P<ID>\w+)' __config = [("use_premium", "bool", "Use premium account if available", True)] @@ -21,6 +21,8 @@ class UploadedTo(SimpleHoster): __authors = [("Walter Purcaro", "vuolter@gmail.com")] + DISPOSITION = False + API_KEY = "lhF2IeeprweDfu9ccWlxXVVypA5nA3EL" URL_REPLACEMENTS = [(__pattern + ".*", r'http://uploaded.net/file/\g<ID>')] diff --git a/pyload/plugin/hoster/XdadevelopersCom.py b/pyload/plugin/hoster/XdadevelopersCom.py index 488d29c44..0fe9197aa 100644 --- a/pyload/plugin/hoster/XdadevelopersCom.py +++ b/pyload/plugin/hoster/XdadevelopersCom.py @@ -33,4 +33,5 @@ class XdadevelopersCom(SimpleHoster): def handleFree(self, pyfile): - self.link = pyfile.url + "&task=get" #@TODO: Revert to `get={'task': "get"}` in 0.4.10 + self.download(pyfile.url, + get={'task': "get"}) diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py index 587c73157..f2b5d0b8f 100644 --- a/pyload/plugin/hoster/Xdcc.py +++ b/pyload/plugin/hoster/Xdcc.py @@ -191,7 +191,7 @@ class Xdcc(Hoster): self.pyfile.name = packname - download_folder = self.config['general']['download_folder'] + download_folder = self.config.get("general", "download_folder") filename = fs_join(download_folder, packname) self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) diff --git a/pyload/plugin/hoster/YadiSk.py b/pyload/plugin/hoster/YadiSk.py index 528d6bc80..f68039e2e 100644 --- a/pyload/plugin/hoster/YadiSk.py +++ b/pyload/plugin/hoster/YadiSk.py @@ -10,7 +10,7 @@ from pyload.utils import json_loads class YadiSk(SimpleHoster): __name = "YadiSk" __type = "hoster" - __version = "0.03" + __version = "0.04" __pattern = r'https?://yadi\.sk/d/\w+' @@ -22,6 +22,42 @@ class YadiSk(SimpleHoster): OFFLINE_PATTERN = r'Nothing found' + @classmethod + def getInfo(cls, url="", html=""): + info = super(YadiSk, cls).getInfo(url, html) + + if html: + if 'idclient' not in info: + info['idclient'] = "" + for _i in xrange(32): + info ['idclient'] += random.choice('0123456abcdef') + + m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', html) + if m: + api_data = json_loads(m.group(1)) + try: + for sect in api_data: + if 'model' in sect: + if sect['model'] == "config": + info['version'] = sect['data']['version'] + info['sk'] = sect['data']['sk'] + + elif sect['model'] == "resource": + info['id'] = sect['data']['id'] + info['size'] = sect['data']['meta']['size'] + info['name'] = sect['data']['name'] + + except Exception, e: + info['status'] = 8 + info['error'] = _("Unexpected server response: %s") % e.message + + else: + info['status'] = 8 + info['error'] = _("could not find required json data") + + return info + + def setup(self): self.resumeDownload = False self.multiDL = False @@ -29,51 +65,18 @@ class YadiSk(SimpleHoster): def handleFree(self, pyfile): - m = re.search(r'<script id="models-client" type="application/json">(.+?)</script>', self.html) - if m is None: - self.error(_("could not find required json data")) - - res = json_loads(m.group(1)) - - yadisk_ver = None - yadisk_sk = None - yadisk_id = None - yadisk_size = None - yadisk_name = None - - try: #@TODO: Copy to apiInfo - for sect in res: - if 'model' in sect: - if sect['model'] == "config": - yadisk_ver = sect['data']['version'] - yadisk_sk = sect['data']['sk'] - - elif sect['model'] == "resource": - yadisk_id = sect['data']['id'] - yadisk_size = sect['data']['meta']['size'] - yadisk_name = sect['data']['name'] - - except Exception, e: - self.fail(_("Unexpected server response"), e) - - if None in (yadisk_id, yadisk_sk, yadisk_id, yadisk_size, yadisk_name): + if any(True for _k in ['id', 'sk', 'version', 'idclient'] if _k not in self.info): self.error(_("Missing JSON data")) - self.pyfile.size = yadisk_size - self.pyfile.name = yadisk_name - - yadisk_idclient = "" - for _i in range(32): - yadisk_idclient += random.choice('0123456abcdef') try: self.html = self.load("https://yadi.sk/models/", get={'_m': "do-get-resource-url"}, - post={'idClient': yadisk_idclient, - 'version' : yadisk_ver, + post={'idClient': self.info['idclient'], + 'version' : self.info['version'], '_model.0': "do-get-resource-url", - 'sk' : yadisk_sk, - 'id.0' : yadisk_id}) + 'sk' : self.info['sk'], + 'id.0' : self.info['id']}) self.link = json_loads(self.html)['models'][0]['data']['file'] diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py index 91a636f0a..a062df458 100644 --- a/pyload/plugin/hoster/ZippyshareCom.py +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -67,13 +67,13 @@ class ZippyshareCom(SimpleHoster): def replElementById(element): - id = element.group(1) # id might be either 'x' (a real id) or x (a variable) + id = element.group(1) #: id might be either 'x' (a real id) or x (a variable) attr = element.group(4) # attr might be None varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr)) realid = id.strip('"\'') - if id != realid: #id is not a variable, so look for realid.attr in the html + if id != realid: #: id is not a variable, so look for realid.attr in the html initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)]) initValue = '"%s"' % initValues[-1] if initValues else 'null' initScripts.add('%s = %s;' % (varName, initValue)) diff --git a/pyload/plugin/internal/SimpleCrypter.py b/pyload/plugin/internal/SimpleCrypter.py index f6c5aa5e2..c6582647f 100644 --- a/pyload/plugin/internal/SimpleCrypter.py +++ b/pyload/plugin/internal/SimpleCrypter.py @@ -15,7 +15,7 @@ class SimpleCrypter(Crypter, SimpleHoster): __version = "0.43" __pattern = r'^unmatchable$' - __config = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] + __config = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config.get("general", "folder_per_package") ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description = """Simple decrypter plugin""" diff --git a/pyload/plugin/internal/SimpleDereferer.py b/pyload/plugin/internal/SimpleDereferer.py index f3596b32c..c82afe0b4 100644 --- a/pyload/plugin/internal/SimpleDereferer.py +++ b/pyload/plugin/internal/SimpleDereferer.py @@ -59,10 +59,7 @@ class SimpleDereferer(Crypter): link = self.getLink() if link.strip(): - self.urls = [link.strip()] #@TODO: Remove `.strip()` in 0.4.10 - - elif not self.urls and not self.packages: #@TODO: Remove in 0.4.10 - self.fail(_("No link grabbed")) + self.urls = [link] def prepare(self): diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py index c0cdc05a8..add54786f 100644 --- a/pyload/plugin/internal/SimpleHoster.py +++ b/pyload/plugin/internal/SimpleHoster.py @@ -244,7 +244,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name = "SimpleHoster" __type = "hoster" - __version = "1.37" + __version = "1.38" __pattern = r'^unmatchable$' __config = [("use_premium", "bool", "Use premium account if available", True)] @@ -609,7 +609,7 @@ class SimpleHoster(Hoster): self.tempOffline() elif status is 8: - self.fail() + self.fail(self.info['error'] if 'error' in self.info else "Failed") finally: self.logDebug("File status: %s" % statusMap[status]) @@ -728,8 +728,8 @@ class SimpleHoster(Hoster): elif traffic == -1: return True else: - size = self.pyfile.size / 1024 - self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size, self.user, traffic)) + size = self.pyfile.size + self.logInfo(_("Filesize: %i KiB, Traffic left for user %s: %i KiB") % (size / 1024, self.user, traffic / 1024)) return size <= traffic @@ -751,8 +751,6 @@ class SimpleHoster(Hoster): self.retries = 0 raise Retry(_("Fallback to free download")) - #@TODO: Remove in 0.4.10 - def wait(self, seconds=0, reconnect=None): return _wait(self, seconds, reconnect) diff --git a/pyload/plugin/internal/XFSHoster.py b/pyload/plugin/internal/XFSHoster.py index 92ec020a6..7b8149bc3 100644 --- a/pyload/plugin/internal/XFSHoster.py +++ b/pyload/plugin/internal/XFSHoster.py @@ -113,7 +113,7 @@ class XFSHoster(SimpleHoster): self.logError(data['op'] if 'op' in data else _("UNKNOWN")) return "" - self.link = m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 + self.link = m.group(1) def handlePremium(self, pyfile): diff --git a/pyload/plugin/ocr/NetloadIn.py b/pyload/plugin/ocr/NetloadIn.py index 9e31d18d5..57651428b 100644 --- a/pyload/plugin/ocr/NetloadIn.py +++ b/pyload/plugin/ocr/NetloadIn.py @@ -24,6 +24,6 @@ class NetloadIn(OCR): self.clean(3) self.run_tesser(True, True, False, False) - self.result_captcha = self.result_captcha.replace(" ", "")[:4] # cut to 4 numbers + self.result_captcha = self.result_captcha.replace(" ", "")[:4] #: cut to 4 numbers return self.result_captcha diff --git a/pyload/remote/ThriftBackend.py b/pyload/remote/ThriftBackend.py index 83bb83811..0ac7f1bb5 100644 --- a/pyload/remote/ThriftBackend.py +++ b/pyload/remote/ThriftBackend.py @@ -9,7 +9,7 @@ from pyload.remote.thriftbackend.Processor import Processor from pyload.remote.thriftbackend.Protocol import ProtocolFactory from pyload.remote.thriftbackend.Socket import ServerSocket from pyload.remote.thriftbackend.Transport import TransportFactory -#from pyload.remote.thriftbackend.Transport import TransportFactoryCompressed +# from pyload.remote.thriftbackend.Transport import TransportFactoryCompressed from thrift.server import TServer @@ -21,11 +21,11 @@ class ThriftBackend(BackendBase): key = None cert = None - if self.core.config['ssl']['activated']: - if exists(self.core.config['ssl']['cert']) and exists(self.core.config['ssl']['key']): + if self.core.config.get("ssl", "activated"): + if exists(self.core.config.get("ssl", "cert")) and exists(self.core.config.get("ssl", "key")): self.core.log.info(_("Using SSL ThriftBackend")) - key = self.core.config['ssl']['key'] - cert = self.core.config['ssl']['cert'] + key = self.core.config.get("ssl", "key") + cert = self.core.config.get("ssl", "cert") transport = ServerSocket(port, host, key, cert) diff --git a/pyload/remote/socketbackend/create_ttypes.py b/pyload/remote/socketbackend/create_ttypes.py index 8c03b8576..72bc4c231 100644 --- a/pyload/remote/socketbackend/create_ttypes.py +++ b/pyload/remote/socketbackend/create_ttypes.py @@ -5,11 +5,6 @@ import os import platform import sys - -if "64" in platform.machine(): - sys.path.append(os.path.join(pypath, "lib64")) -sys.path.append(os.path.join(pypath, "lib", "Python", "Lib")) - sys.path.append(os.path.join(pypath, "pyload", "remote")) from pyload.remote.thriftbackend.thriftgen.pyload import ttypes diff --git a/pyload/remote/thriftbackend/Socket.py b/pyload/remote/thriftbackend/Socket.py index 7e1268c5c..7d078ab93 100644 --- a/pyload/remote/thriftbackend/Socket.py +++ b/pyload/remote/thriftbackend/Socket.py @@ -8,7 +8,7 @@ from time import sleep from thrift.transport.TSocket import TSocket, TServerSocket, TTransportException -WantReadError = Exception #overwritten when ssl is used +WantReadError = Exception #: overwritten when ssl is used class SecureSocketConnection(object): diff --git a/pyload/remote/thriftbackend/ThriftClient.py b/pyload/remote/thriftbackend/ThriftClient.py index c779c9b9c..60a4e9ca9 100644 --- a/pyload/remote/thriftbackend/ThriftClient.py +++ b/pyload/remote/thriftbackend/ThriftClient.py @@ -1,21 +1,13 @@ # -*- coding: utf-8 -*- import sys +import thrift + from socket import error from traceback import print_exc -try: - import thrift - -except ImportError: - import platform - - if "64" in platform.machine(): - sys.path.append(os.path.join(pypath, "lib64")) - sys.path.append(os.path.join(pypath, "lib", "Python", "Lib")) - from thrift.transport import TTransport -#from thrift.transport.TZlibTransport import TZlibTransport +# from thrift.transport.TZlibTransport import TZlibTransport from Socket import Socket from Protocol import Protocol diff --git a/pyload/remote/thriftbackend/ThriftTest.py b/pyload/remote/thriftbackend/ThriftTest.py index f4c927bd7..fb8dd03c9 100644 --- a/pyload/remote/thriftbackend/ThriftTest.py +++ b/pyload/remote/thriftbackend/ThriftTest.py @@ -48,8 +48,8 @@ proxy = xmlrpclib.ServerProxy(server_url, allow_none=True) bench(proxy.get_server_version) bench(proxy.status_server) bench(proxy.status_downloads) -#bench(proxy.get_queue) -#bench(proxy.get_collector) +# bench(proxy.get_queue) +# bench(proxy.get_collector) print try: diff --git a/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py b/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py index 874b705ba..a5e730c35 100644 --- a/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ b/pyload/remote/thriftbackend/thriftgen/pyload/Pyload.py @@ -3667,10 +3667,10 @@ class getConfigValue_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'category', None, None,), # 1 - (2, TType.STRING, 'option', None, None,), # 2 - (3, TType.STRING, 'section', None, None,), # 3 + None, #: 0 + (1, TType.STRING, 'category', None, None,), #: 1 + (2, TType.STRING, 'option', None, None,), #: 2 + (3, TType.STRING, 'section', None, None,), #: 3 ) @@ -3691,7 +3691,7 @@ class getConfigValue_result(TBase): ] thrift_spec = ( - (0, TType.STRING, 'success', None, None,), # 0 + (0, TType.STRING, 'success', None, None,), #: 0 ) @@ -3716,11 +3716,11 @@ class setConfigValue_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'category', None, None,), # 1 - (2, TType.STRING, 'option', None, None,), # 2 - (3, TType.STRING, 'value', None, None,), # 3 - (4, TType.STRING, 'section', None, None,), # 4 + None, #: 0 + (1, TType.STRING, 'category', None, None,), #: 1 + (2, TType.STRING, 'option', None, None,), #: 2 + (3, TType.STRING, 'value', None, None,), #: 3 + (4, TType.STRING, 'section', None, None,), #: 4 ) @@ -3760,7 +3760,7 @@ class getConfig_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.STRUCT, (ConfigSection, ConfigSection.thrift_spec)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.STRUCT, (ConfigSection, ConfigSection.thrift_spec)), None,), #: 0 ) @@ -3788,7 +3788,7 @@ class getPluginConfig_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.STRUCT, (ConfigSection, ConfigSection.thrift_spec)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.STRUCT, (ConfigSection, ConfigSection.thrift_spec)), None,), #: 0 ) @@ -3852,7 +3852,7 @@ class togglePause_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -3880,7 +3880,7 @@ class statusServer_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (ServerStatus, ServerStatus.thrift_spec), None,), # 0 + (0, TType.STRUCT, 'success', (ServerStatus, ServerStatus.thrift_spec), None,), #: 0 ) @@ -3908,7 +3908,7 @@ class freeSpace_result(TBase): ] thrift_spec = ( - (0, TType.I64, 'success', None, None,), # 0 + (0, TType.I64, 'success', None, None,), #: 0 ) @@ -3936,7 +3936,7 @@ class getServerVersion_result(TBase): ] thrift_spec = ( - (0, TType.STRING, 'success', None, None,), # 0 + (0, TType.STRING, 'success', None, None,), #: 0 ) @@ -3991,8 +3991,8 @@ class getLog_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'offset', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'offset', None, None,), #: 1 ) @@ -4011,7 +4011,7 @@ class getLog_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRING, None), None,), # 0 + (0, TType.LIST, 'success', (TType.STRING, None), None,), #: 0 ) @@ -4039,7 +4039,7 @@ class isTimeDownload_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -4067,7 +4067,7 @@ class isTimeReconnect_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -4095,7 +4095,7 @@ class toggleReconnect_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -4114,8 +4114,8 @@ class generatePackages_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'links', (TType.STRING, None), None,), # 1 + None, #: 0 + (1, TType.LIST, 'links', (TType.STRING, None), None,), #: 1 ) @@ -4134,7 +4134,7 @@ class generatePackages_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), #: 0 ) @@ -4153,8 +4153,8 @@ class checkURLs_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'urls', (TType.STRING, None), None,), # 1 + None, #: 0 + (1, TType.LIST, 'urls', (TType.STRING, None), None,), #: 1 ) @@ -4173,7 +4173,7 @@ class checkURLs_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), #: 0 ) @@ -4194,9 +4194,9 @@ class parseURLs_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'html', None, None,), # 1 - (2, TType.STRING, 'url', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'html', None, None,), #: 1 + (2, TType.STRING, 'url', None, None,), #: 2 ) @@ -4216,7 +4216,7 @@ class parseURLs_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), #: 0 ) @@ -4235,8 +4235,8 @@ class checkOnlineStatus_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'urls', (TType.STRING, None), None,), # 1 + None, #: 0 + (1, TType.LIST, 'urls', (TType.STRING, None), None,), #: 1 ) @@ -4255,7 +4255,7 @@ class checkOnlineStatus_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None,), # 0 + (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None,), #: 0 ) @@ -4278,10 +4278,10 @@ class checkOnlineStatusContainer_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'urls', (TType.STRING, None), None,), # 1 - (2, TType.STRING, 'filename', None, None,), # 2 - (3, TType.STRING, 'data', None, None,), # 3 + None, #: 0 + (1, TType.LIST, 'urls', (TType.STRING, None), None,), #: 1 + (2, TType.STRING, 'filename', None, None,), #: 2 + (3, TType.STRING, 'data', None, None,), #: 3 ) @@ -4302,7 +4302,7 @@ class checkOnlineStatusContainer_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None,), # 0 + (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None,), #: 0 ) @@ -4321,8 +4321,8 @@ class pollResults_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'rid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'rid', None, None,), #: 1 ) @@ -4341,7 +4341,7 @@ class pollResults_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None,), # 0 + (0, TType.STRUCT, 'success', (OnlineCheck, OnlineCheck.thrift_spec), None,), #: 0 ) @@ -4369,7 +4369,7 @@ class statusDownloads_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (DownloadInfo, DownloadInfo.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (DownloadInfo, DownloadInfo.thrift_spec)), None,), #: 0 ) @@ -4388,8 +4388,8 @@ class getPackageData_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -4410,8 +4410,8 @@ class getPackageData_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (PackageData, PackageData.thrift_spec), None,), # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None,), # 1 + (0, TType.STRUCT, 'success', (PackageData, PackageData.thrift_spec), None,), #: 0 + (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None,), #: 1 ) @@ -4431,8 +4431,8 @@ class getPackageInfo_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -4453,8 +4453,8 @@ class getPackageInfo_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (PackageData, PackageData.thrift_spec), None,), # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None,), # 1 + (0, TType.STRUCT, 'success', (PackageData, PackageData.thrift_spec), None,), #: 0 + (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None,), #: 1 ) @@ -4474,8 +4474,8 @@ class getFileData_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'fid', None, None,), #: 1 ) @@ -4496,8 +4496,8 @@ class getFileData_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (FileData, FileData.thrift_spec), None,), # 0 - (1, TType.STRUCT, 'e', (FileDoesNotExists, FileDoesNotExists.thrift_spec), None,), # 1 + (0, TType.STRUCT, 'success', (FileData, FileData.thrift_spec), None,), #: 0 + (1, TType.STRUCT, 'e', (FileDoesNotExists, FileDoesNotExists.thrift_spec), None,), #: 1 ) @@ -4526,7 +4526,7 @@ class getQueue_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), #: 0 ) @@ -4554,7 +4554,7 @@ class getCollector_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), #: 0 ) @@ -4582,7 +4582,7 @@ class getQueueData_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), #: 0 ) @@ -4610,7 +4610,7 @@ class getCollectorData_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (PackageData, PackageData.thrift_spec)), None,), #: 0 ) @@ -4629,8 +4629,8 @@ class getPackageOrder_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'destination', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'destination', None, None,), #: 1 ) @@ -4649,7 +4649,7 @@ class getPackageOrder_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.I16, None, TType.I32, None), None,), # 0 + (0, TType.MAP, 'success', (TType.I16, None, TType.I32, None), None,), #: 0 ) @@ -4668,8 +4668,8 @@ class getFileOrder_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -4688,7 +4688,7 @@ class getFileOrder_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.I16, None, TType.I32, None), None,), # 0 + (0, TType.MAP, 'success', (TType.I16, None, TType.I32, None), None,), #: 0 ) @@ -4709,9 +4709,9 @@ class generateAndAddPackages_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'links', (TType.STRING, None), None,), # 1 - (2, TType.I32, 'dest', None, None,), # 2 + None, #: 0 + (1, TType.LIST, 'links', (TType.STRING, None), None,), #: 1 + (2, TType.I32, 'dest', None, None,), #: 2 ) @@ -4731,7 +4731,7 @@ class generateAndAddPackages_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.I32, None), None,), # 0 + (0, TType.LIST, 'success', (TType.I32, None), None,), #: 0 ) @@ -4754,10 +4754,10 @@ class addPackage_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None,), # 1 - (2, TType.LIST, 'links', (TType.STRING, None), None,), # 2 - (3, TType.I32, 'dest', None, None,), # 3 + None, #: 0 + (1, TType.STRING, 'name', None, None,), #: 1 + (2, TType.LIST, 'links', (TType.STRING, None), None,), #: 2 + (3, TType.I32, 'dest', None, None,), #: 3 ) @@ -4778,7 +4778,7 @@ class addPackage_result(TBase): ] thrift_spec = ( - (0, TType.I32, 'success', None, None,), # 0 + (0, TType.I32, 'success', None, None,), #: 0 ) @@ -4799,9 +4799,9 @@ class addFiles_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 - (2, TType.LIST, 'links', (TType.STRING, None), None,), # 2 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 + (2, TType.LIST, 'links', (TType.STRING, None), None,), #: 2 ) @@ -4832,9 +4832,9 @@ class uploadContainer_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'filename', None, None,), # 1 - (2, TType.STRING, 'data', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'filename', None, None,), #: 1 + (2, TType.STRING, 'data', None, None,), #: 2 ) @@ -4863,8 +4863,8 @@ class deleteFiles_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32, None), None,), # 1 + None, #: 0 + (1, TType.LIST, 'fids', (TType.I32, None), None,), #: 1 ) @@ -4892,8 +4892,8 @@ class deletePackages_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'pids', (TType.I32, None), None,), # 1 + None, #: 0 + (1, TType.LIST, 'pids', (TType.I32, None), None,), #: 1 ) @@ -4921,8 +4921,8 @@ class pushToQueue_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -4950,8 +4950,8 @@ class pullFromQueue_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -4979,8 +4979,8 @@ class restartPackage_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -5008,8 +5008,8 @@ class restartFile_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'fid', None, None,), #: 1 ) @@ -5037,8 +5037,8 @@ class recheckPackage_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -5084,8 +5084,8 @@ class stopDownloads_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32, None), None,), # 1 + None, #: 0 + (1, TType.LIST, 'fids', (TType.I32, None), None,), #: 1 ) @@ -5115,9 +5115,9 @@ class setPackageName_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 - (2, TType.STRING, 'name', None, None,), # 2 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 + (2, TType.STRING, 'name', None, None,), #: 2 ) @@ -5148,9 +5148,9 @@ class movePackage_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'destination', None, None,), # 1 - (2, TType.I32, 'pid', None, None,), # 2 + None, #: 0 + (1, TType.I32, 'destination', None, None,), #: 1 + (2, TType.I32, 'pid', None, None,), #: 2 ) @@ -5181,9 +5181,9 @@ class moveFiles_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.LIST, 'fids', (TType.I32, None), None,), # 1 - (2, TType.I32, 'pid', None, None,), # 2 + None, #: 0 + (1, TType.LIST, 'fids', (TType.I32, None), None,), #: 1 + (2, TType.I32, 'pid', None, None,), #: 2 ) @@ -5214,9 +5214,9 @@ class orderPackage_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 - (2, TType.I16, 'position', None, None,), # 2 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 + (2, TType.I16, 'position', None, None,), #: 2 ) @@ -5247,9 +5247,9 @@ class orderFile_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None,), # 1 - (2, TType.I16, 'position', None, None,), # 2 + None, #: 0 + (1, TType.I32, 'fid', None, None,), #: 1 + (2, TType.I16, 'position', None, None,), #: 2 ) @@ -5280,9 +5280,9 @@ class setPackageData_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 - (2, TType.MAP, 'data', (TType.STRING, None, TType.STRING, None), None,), # 2 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 + (2, TType.MAP, 'data', (TType.STRING, None, TType.STRING, None), None,), #: 2 ) @@ -5302,8 +5302,8 @@ class setPackageData_result(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None,), # 1 + None, #: 0 + (1, TType.STRUCT, 'e', (PackageDoesNotExists, PackageDoesNotExists.thrift_spec), None,), #: 1 ) @@ -5331,7 +5331,7 @@ class deleteFinished_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.I32, None), None,), # 0 + (0, TType.LIST, 'success', (TType.I32, None), None,), #: 0 ) @@ -5368,8 +5368,8 @@ class getEvents_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'uuid', None, None,), # 1 + None, #: 0 + (1, TType.STRING, 'uuid', None, None,), #: 1 ) @@ -5388,7 +5388,7 @@ class getEvents_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (EventInfo, EventInfo.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (EventInfo, EventInfo.thrift_spec)), None,), #: 0 ) @@ -5407,8 +5407,8 @@ class getAccounts_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.BOOL, 'refresh', None, None,), # 1 + None, #: 0 + (1, TType.BOOL, 'refresh', None, None,), #: 1 ) @@ -5427,7 +5427,7 @@ class getAccounts_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRUCT, (AccountInfo, AccountInfo.thrift_spec)), None,), # 0 + (0, TType.LIST, 'success', (TType.STRUCT, (AccountInfo, AccountInfo.thrift_spec)), None,), #: 0 ) @@ -5455,7 +5455,7 @@ class getAccountTypes_result(TBase): ] thrift_spec = ( - (0, TType.LIST, 'success', (TType.STRING, None), None,), # 0 + (0, TType.LIST, 'success', (TType.STRING, None), None,), #: 0 ) @@ -5480,11 +5480,11 @@ class updateAccount_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None,), # 1 - (2, TType.STRING, 'account', None, None,), # 2 - (3, TType.STRING, 'password', None, None,), # 3 - (4, TType.MAP, 'options', (TType.STRING, None, TType.STRING, None), None,), # 4 + None, #: 0 + (1, TType.STRING, 'plugin', None, None,), #: 1 + (2, TType.STRING, 'account', None, None,), #: 2 + (3, TType.STRING, 'password', None, None,), #: 3 + (4, TType.MAP, 'options', (TType.STRING, None, TType.STRING, None), None,), #: 4 ) @@ -5517,9 +5517,9 @@ class removeAccount_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None,), # 1 - (2, TType.STRING, 'account', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'plugin', None, None,), #: 1 + (2, TType.STRING, 'account', None, None,), #: 2 ) @@ -5550,9 +5550,9 @@ class login_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'username', None, None,), # 1 - (2, TType.STRING, 'password', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'username', None, None,), #: 1 + (2, TType.STRING, 'password', None, None,), #: 2 ) @@ -5572,7 +5572,7 @@ class login_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -5593,9 +5593,9 @@ class getUserData_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'username', None, None,), # 1 - (2, TType.STRING, 'password', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'username', None, None,), #: 1 + (2, TType.STRING, 'password', None, None,), #: 2 ) @@ -5615,7 +5615,7 @@ class getUserData_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (UserData, UserData.thrift_spec), None,), # 0 + (0, TType.STRUCT, 'success', (UserData, UserData.thrift_spec), None,), #: 0 ) @@ -5643,7 +5643,7 @@ class getAllUserData_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.STRUCT, (UserData, UserData.thrift_spec)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.STRUCT, (UserData, UserData.thrift_spec)), None,), #: 0 ) @@ -5671,7 +5671,7 @@ class getServices_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.MAP, (TType.STRING, None, TType.STRING, None)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.MAP, (TType.STRING, None, TType.STRING, None)), None,), #: 0 ) @@ -5692,9 +5692,9 @@ class hasService_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None,), # 1 - (2, TType.STRING, 'func', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'plugin', None, None,), #: 1 + (2, TType.STRING, 'func', None, None,), #: 2 ) @@ -5714,7 +5714,7 @@ class hasService_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -5733,8 +5733,8 @@ class call_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRUCT, 'info', (ServiceCall, ServiceCall.thrift_spec), None,), # 1 + None, #: 0 + (1, TType.STRUCT, 'info', (ServiceCall, ServiceCall.thrift_spec), None,), #: 1 ) @@ -5757,9 +5757,9 @@ class call_result(TBase): ] thrift_spec = ( - (0, TType.STRING, 'success', None, None,), # 0 - (1, TType.STRUCT, 'ex', (ServiceDoesNotExists, ServiceDoesNotExists.thrift_spec), None,), # 1 - (2, TType.STRUCT, 'e', (ServiceException, ServiceException.thrift_spec), None,), # 2 + (0, TType.STRING, 'success', None, None,), #: 0 + (1, TType.STRUCT, 'ex', (ServiceDoesNotExists, ServiceDoesNotExists.thrift_spec), None,), #: 1 + (2, TType.STRUCT, 'e', (ServiceException, ServiceException.thrift_spec), None,), #: 2 ) @@ -5789,7 +5789,7 @@ class getAllInfo_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.MAP, (TType.STRING, None, TType.STRING, None)), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.MAP, (TType.STRING, None, TType.STRING, None)), None,), #: 0 ) @@ -5808,8 +5808,8 @@ class getInfoByPlugin_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None,), # 1 + None, #: 0 + (1, TType.STRING, 'plugin', None, None,), #: 1 ) @@ -5828,7 +5828,7 @@ class getInfoByPlugin_result(TBase): ] thrift_spec = ( - (0, TType.MAP, 'success', (TType.STRING, None, TType.STRING, None), None,), # 0 + (0, TType.MAP, 'success', (TType.STRING, None, TType.STRING, None), None,), #: 0 ) @@ -5856,7 +5856,7 @@ class isCaptchaWaiting_result(TBase): ] thrift_spec = ( - (0, TType.BOOL, 'success', None, None,), # 0 + (0, TType.BOOL, 'success', None, None,), #: 0 ) @@ -5875,8 +5875,8 @@ class getCaptchaTask_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.BOOL, 'exclusive', None, None,), # 1 + None, #: 0 + (1, TType.BOOL, 'exclusive', None, None,), #: 1 ) @@ -5895,7 +5895,7 @@ class getCaptchaTask_result(TBase): ] thrift_spec = ( - (0, TType.STRUCT, 'success', (CaptchaTask, CaptchaTask.thrift_spec), None,), # 0 + (0, TType.STRUCT, 'success', (CaptchaTask, CaptchaTask.thrift_spec), None,), #: 0 ) @@ -5914,8 +5914,8 @@ class getCaptchaTaskStatus_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'tid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'tid', None, None,), #: 1 ) @@ -5934,7 +5934,7 @@ class getCaptchaTaskStatus_result(TBase): ] thrift_spec = ( - (0, TType.STRING, 'success', None, None,), # 0 + (0, TType.STRING, 'success', None, None,), #: 0 ) @@ -5955,9 +5955,9 @@ class setCaptchaResult_args(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'tid', None, None,), # 1 - (2, TType.STRING, 'result', None, None,), # 2 + None, #: 0 + (1, TType.I32, 'tid', None, None,), #: 1 + (2, TType.STRING, 'result', None, None,), #: 2 ) diff --git a/pyload/remote/thriftbackend/thriftgen/pyload/ttypes.py b/pyload/remote/thriftbackend/thriftgen/pyload/ttypes.py index 70b29ff1e..1c18f6421 100644 --- a/pyload/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/pyload/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -189,23 +189,23 @@ class DownloadInfo(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None,), # 1 - (2, TType.STRING, 'name', None, None,), # 2 - (3, TType.I64, 'speed', None, None,), # 3 - (4, TType.I32, 'eta', None, None,), # 4 - (5, TType.STRING, 'format_eta', None, None,), # 5 - (6, TType.I64, 'bleft', None, None,), # 6 - (7, TType.I64, 'size', None, None,), # 7 - (8, TType.STRING, 'format_size', None, None,), # 8 - (9, TType.BYTE, 'percent', None, None,), # 9 - (10, TType.I32, 'status', None, None,), # 10 - (11, TType.STRING, 'statusmsg', None, None,), # 11 - (12, TType.STRING, 'format_wait', None, None,), # 12 - (13, TType.I64, 'wait_until', None, None,), # 13 - (14, TType.I32, 'packageID', None, None,), # 14 - (15, TType.STRING, 'packageName', None, None,), # 15 - (16, TType.STRING, 'plugin', None, None,), # 16 + None, #: 0 + (1, TType.I32, 'fid', None, None,), #: 1 + (2, TType.STRING, 'name', None, None,), #: 2 + (3, TType.I64, 'speed', None, None,), #: 3 + (4, TType.I32, 'eta', None, None,), #: 4 + (5, TType.STRING, 'format_eta', None, None,), #: 5 + (6, TType.I64, 'bleft', None, None,), #: 6 + (7, TType.I64, 'size', None, None,), #: 7 + (8, TType.STRING, 'format_size', None, None,), #: 8 + (9, TType.BYTE, 'percent', None, None,), #: 9 + (10, TType.I32, 'status', None, None,), #: 10 + (11, TType.STRING, 'statusmsg', None, None,), #: 11 + (12, TType.STRING, 'format_wait', None, None,), #: 12 + (13, TType.I64, 'wait_until', None, None,), #: 13 + (14, TType.I32, 'packageID', None, None,), #: 14 + (15, TType.STRING, 'packageName', None, None,), #: 15 + (16, TType.STRING, 'plugin', None, None,), #: 16 ) @@ -251,14 +251,14 @@ class ServerStatus(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.BOOL, 'pause', None, None,), # 1 - (2, TType.I16, 'active', None, None,), # 2 - (3, TType.I16, 'queue', None, None,), # 3 - (4, TType.I16, 'total', None, None,), # 4 - (5, TType.I64, 'speed', None, None,), # 5 - (6, TType.BOOL, 'download', None, None,), # 6 - (7, TType.BOOL, 'reconnect', None, None,), # 7 + None, #: 0 + (1, TType.BOOL, 'pause', None, None,), #: 1 + (2, TType.I16, 'active', None, None,), #: 2 + (3, TType.I16, 'queue', None, None,), #: 3 + (4, TType.I16, 'total', None, None,), #: 4 + (5, TType.I64, 'speed', None, None,), #: 5 + (6, TType.BOOL, 'download', None, None,), #: 6 + (7, TType.BOOL, 'reconnect', None, None,), #: 7 ) @@ -289,11 +289,11 @@ class ConfigItem(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None,), # 1 - (2, TType.STRING, 'description', None, None,), # 2 - (3, TType.STRING, 'value', None, None,), # 3 - (4, TType.STRING, 'type', None, None,), # 4 + None, #: 0 + (1, TType.STRING, 'name', None, None,), #: 1 + (2, TType.STRING, 'description', None, None,), #: 2 + (3, TType.STRING, 'value', None, None,), #: 3 + (4, TType.STRING, 'type', None, None,), #: 4 ) @@ -321,11 +321,11 @@ class ConfigSection(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None,), # 1 - (2, TType.STRING, 'description', None, None,), # 2 - (3, TType.LIST, 'items', (TType.STRUCT, (ConfigItem, ConfigItem.thrift_spec)), None,), # 3 - (4, TType.STRING, 'outline', None, None,), # 4 + None, #: 0 + (1, TType.STRING, 'name', None, None,), #: 1 + (2, TType.STRING, 'description', None, None,), #: 2 + (3, TType.LIST, 'items', (TType.STRUCT, (ConfigItem, ConfigItem.thrift_spec)), None,), #: 3 + (4, TType.STRING, 'outline', None, None,), #: 4 ) @@ -367,18 +367,18 @@ class FileData(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None,), # 1 - (2, TType.STRING, 'url', None, None,), # 2 - (3, TType.STRING, 'name', None, None,), # 3 - (4, TType.STRING, 'plugin', None, None,), # 4 - (5, TType.I64, 'size', None, None,), # 5 - (6, TType.STRING, 'format_size', None, None,), # 6 - (7, TType.I32, 'status', None, None,), # 7 - (8, TType.STRING, 'statusmsg', None, None,), # 8 - (9, TType.I32, 'packageID', None, None,), # 9 - (10, TType.STRING, 'error', None, None,), # 10 - (11, TType.I16, 'order', None, None,), # 11 + None, #: 0 + (1, TType.I32, 'fid', None, None,), #: 1 + (2, TType.STRING, 'url', None, None,), #: 2 + (3, TType.STRING, 'name', None, None,), #: 3 + (4, TType.STRING, 'plugin', None, None,), #: 4 + (5, TType.I64, 'size', None, None,), #: 5 + (6, TType.STRING, 'format_size', None, None,), #: 6 + (7, TType.I32, 'status', None, None,), #: 7 + (8, TType.STRING, 'statusmsg', None, None,), #: 8 + (9, TType.I32, 'packageID', None, None,), #: 9 + (10, TType.STRING, 'error', None, None,), #: 10 + (11, TType.I16, 'order', None, None,), #: 11 ) @@ -431,20 +431,20 @@ class PackageData(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 - (2, TType.STRING, 'name', None, None,), # 2 - (3, TType.STRING, 'folder', None, None,), # 3 - (4, TType.STRING, 'site', None, None,), # 4 - (5, TType.STRING, 'password', None, None,), # 5 - (6, TType.I32, 'dest', None, None,), # 6 - (7, TType.I16, 'order', None, None,), # 7 - (8, TType.I16, 'linksdone', None, None,), # 8 - (9, TType.I64, 'sizedone', None, None,), # 9 - (10, TType.I64, 'sizetotal', None, None,), # 10 - (11, TType.I16, 'linkstotal', None, None,), # 11 - (12, TType.LIST, 'links', (TType.STRUCT, (FileData, FileData.thrift_spec)), None,), # 12 - (13, TType.LIST, 'fids', (TType.I32, None), None,), # 13 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 + (2, TType.STRING, 'name', None, None,), #: 2 + (3, TType.STRING, 'folder', None, None,), #: 3 + (4, TType.STRING, 'site', None, None,), #: 4 + (5, TType.STRING, 'password', None, None,), #: 5 + (6, TType.I32, 'dest', None, None,), #: 6 + (7, TType.I16, 'order', None, None,), #: 7 + (8, TType.I16, 'linksdone', None, None,), #: 8 + (9, TType.I64, 'sizedone', None, None,), #: 9 + (10, TType.I64, 'sizetotal', None, None,), #: 10 + (11, TType.I16, 'linkstotal', None, None,), #: 11 + (12, TType.LIST, 'links', (TType.STRUCT, (FileData, FileData.thrift_spec)), None,), #: 12 + (13, TType.LIST, 'fids', (TType.I32, None), None,), #: 13 ) @@ -491,16 +491,16 @@ class InteractionTask(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'iid', None, None,), # 1 - (2, TType.I32, 'input', None, None,), # 2 - (3, TType.LIST, 'structure', (TType.STRING, None), None,), # 3 - (4, TType.LIST, 'preset', (TType.STRING, None), None,), # 4 - (5, TType.I32, 'output', None, None,), # 5 - (6, TType.LIST, 'data', (TType.STRING, None), None,), # 6 - (7, TType.STRING, 'title', None, None,), # 7 - (8, TType.STRING, 'description', None, None,), # 8 - (9, TType.STRING, 'plugin', None, None,), # 9 + None, #: 0 + (1, TType.I32, 'iid', None, None,), #: 1 + (2, TType.I32, 'input', None, None,), #: 2 + (3, TType.LIST, 'structure', (TType.STRING, None), None,), #: 3 + (4, TType.LIST, 'preset', (TType.STRING, None), None,), #: 4 + (5, TType.I32, 'output', None, None,), #: 5 + (6, TType.LIST, 'data', (TType.STRING, None), None,), #: 6 + (7, TType.STRING, 'title', None, None,), #: 7 + (8, TType.STRING, 'description', None, None,), #: 8 + (9, TType.STRING, 'plugin', None, None,), #: 9 ) @@ -533,11 +533,11 @@ class CaptchaTask(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I16, 'tid', None, None,), # 1 - (2, TType.STRING, 'data', None, None,), # 2 - (3, TType.STRING, 'type', None, None,), # 3 - (4, TType.STRING, 'resultType', None, None,), # 4 + None, #: 0 + (1, TType.I16, 'tid', None, None,), #: 1 + (2, TType.STRING, 'data', None, None,), #: 2 + (3, TType.STRING, 'type', None, None,), #: 3 + (4, TType.STRING, 'resultType', None, None,), #: 4 ) @@ -565,11 +565,11 @@ class EventInfo(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'eventname', None, None,), # 1 - (2, TType.I32, 'id', None, None,), # 2 - (3, TType.I32, 'type', None, None,), # 3 - (4, TType.I32, 'destination', None, None,), # 4 + None, #: 0 + (1, TType.STRING, 'eventname', None, None,), #: 1 + (2, TType.I32, 'id', None, None,), #: 2 + (3, TType.I32, 'type', None, None,), #: 3 + (4, TType.I32, 'destination', None, None,), #: 4 ) @@ -599,12 +599,12 @@ class UserData(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None,), # 1 - (2, TType.STRING, 'email', None, None,), # 2 - (3, TType.I32, 'role', None, None,), # 3 - (4, TType.I32, 'permission', None, None,), # 4 - (5, TType.STRING, 'templateName', None, None,), # 5 + None, #: 0 + (1, TType.STRING, 'name', None, None,), #: 1 + (2, TType.STRING, 'email', None, None,), #: 2 + (3, TType.I32, 'role', None, None,), #: 3 + (4, TType.I32, 'permission', None, None,), #: 4 + (5, TType.STRING, 'templateName', None, None,), #: 5 ) @@ -641,15 +641,15 @@ class AccountInfo(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I64, 'validuntil', None, None,), # 1 - (2, TType.STRING, 'login', None, None,), # 2 - (3, TType.MAP, 'options', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), # 3 - (4, TType.BOOL, 'valid', None, None,), # 4 - (5, TType.I64, 'trafficleft', None, None,), # 5 - (6, TType.I64, 'maxtraffic', None, None,), # 6 - (7, TType.BOOL, 'premium', None, None,), # 7 - (8, TType.STRING, 'type', None, None,), # 8 + None, #: 0 + (1, TType.I64, 'validuntil', None, None,), #: 1 + (2, TType.STRING, 'login', None, None,), #: 2 + (3, TType.MAP, 'options', (TType.STRING, None, TType.LIST, (TType.STRING, None)), None,), #: 3 + (4, TType.BOOL, 'valid', None, None,), #: 4 + (5, TType.I64, 'trafficleft', None, None,), #: 5 + (6, TType.I64, 'maxtraffic', None, None,), #: 6 + (7, TType.BOOL, 'premium', None, None,), #: 7 + (8, TType.STRING, 'type', None, None,), #: 8 ) @@ -681,11 +681,11 @@ class ServiceCall(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None,), # 1 - (2, TType.STRING, 'func', None, None,), # 2 - (3, TType.LIST, 'arguments', (TType.STRING, None), None,), # 3 - (4, TType.BOOL, 'parseArguments', None, None,), # 4 + None, #: 0 + (1, TType.STRING, 'plugin', None, None,), #: 1 + (2, TType.STRING, 'func', None, None,), #: 2 + (3, TType.LIST, 'arguments', (TType.STRING, None), None,), #: 3 + (4, TType.BOOL, 'parseArguments', None, None,), #: 4 ) @@ -715,12 +715,12 @@ class OnlineStatus(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'name', None, None,), # 1 - (2, TType.STRING, 'plugin', None, None,), # 2 - (3, TType.STRING, 'packagename', None, None,), # 3 - (4, TType.I32, 'status', None, None,), # 4 - (5, TType.I64, 'size', None, None,), # 5 + None, #: 0 + (1, TType.STRING, 'name', None, None,), #: 1 + (2, TType.STRING, 'plugin', None, None,), #: 2 + (3, TType.STRING, 'packagename', None, None,), #: 3 + (4, TType.I32, 'status', None, None,), #: 4 + (5, TType.I64, 'size', None, None,), #: 5 ) @@ -745,9 +745,9 @@ class OnlineCheck(TBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'rid', None, None,), # 1 - (2, TType.MAP, 'data', (TType.STRING, None, TType.STRUCT, (OnlineStatus, OnlineStatus.thrift_spec)), None,), # 2 + None, #: 0 + (1, TType.I32, 'rid', None, None,), #: 1 + (2, TType.MAP, 'data', (TType.STRING, None, TType.STRUCT, (OnlineStatus, OnlineStatus.thrift_spec)), None,), #: 2 ) @@ -767,8 +767,8 @@ class PackageDoesNotExists(TExceptionBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'pid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'pid', None, None,), #: 1 ) @@ -791,8 +791,8 @@ class FileDoesNotExists(TExceptionBase): ] thrift_spec = ( - None, # 0 - (1, TType.I32, 'fid', None, None,), # 1 + None, #: 0 + (1, TType.I32, 'fid', None, None,), #: 1 ) @@ -817,9 +817,9 @@ class ServiceDoesNotExists(TExceptionBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'plugin', None, None,), # 1 - (2, TType.STRING, 'func', None, None,), # 2 + None, #: 0 + (1, TType.STRING, 'plugin', None, None,), #: 1 + (2, TType.STRING, 'func', None, None,), #: 2 ) @@ -843,8 +843,8 @@ class ServiceException(TExceptionBase): ] thrift_spec = ( - None, # 0 - (1, TType.STRING, 'msg', None, None,), # 1 + None, #: 0 + (1, TType.STRING, 'msg', None, None,), #: 1 ) diff --git a/pyload/utils/__init__.py b/pyload/utils/__init__.py index 22f92222e..648432c26 100644 --- a/pyload/utils/__init__.py +++ b/pyload/utils/__init__.py @@ -8,7 +8,7 @@ import re import sys import time -#from gettext import gettext +# from gettext import gettext import pylgettext as gettext from htmlentitydefs import name2codepoint from os.path import join diff --git a/pyload/utils/pylgettext.py b/pyload/utils/pylgettext.py index cab631cf4..0e3ebad80 100644 --- a/pyload/utils/pylgettext.py +++ b/pyload/utils/pylgettext.py @@ -56,5 +56,5 @@ def find(domain, localedir=None, languages=None, all=False): else: return results -#Is there a smarter/cleaner pythonic way for this? +# Is there a smarter/cleaner pythonic way for this? translation.func_globals['find'] = find diff --git a/pyload/webui/app/api.py b/pyload/webui/app/api.py index 1f335f82e..dd8521a07 100644 --- a/pyload/webui/app/api.py +++ b/pyload/webui/app/api.py @@ -68,7 +68,7 @@ def callApi(func, *args, **kwargs): return json.dumps(result, cls=TBaseEncoder) -#post -> username, password +# post -> username, password @route('/api/login', method='POST') def login(): response.headers.replace("Content-type", "application/json") diff --git a/pyload/webui/app/json.py b/pyload/webui/app/json.py index b61f57a8c..700b310a0 100644 --- a/pyload/webui/app/json.py +++ b/pyload/webui/app/json.py @@ -278,7 +278,7 @@ def add_account(): @route('/json/update_accounts', method='POST') @login_required("ACCOUNTS") def update_accounts(): - deleted = [] #dont update deleted accs or they will be created again + deleted = [] #: dont update deleted accs or they will be created again for name, value in request.POST.iteritems(): value = value.strip() diff --git a/pyload/webui/servers/lighttpd_default.conf b/pyload/webui/servers/lighttpd_default.conf index aa199b3f3..a821096c6 100644 --- a/pyload/webui/servers/lighttpd_default.conf +++ b/pyload/webui/servers/lighttpd_default.conf @@ -47,7 +47,7 @@ index-file.names = ( "index.php", "index.html", "index.htm", "default.htm" ) ## set the event-handler (read the performance section in the manual) -# server.event-handler = "freebsd-kqueue" # needed on OS X +# server.event-handler = "freebsd-kqueue" #: needed on OS X # mimetype mapping mimetype.assign = ( diff --git a/tests/APIExerciser.py b/tests/APIExerciser.py index 5e84bfefe..38dd9fceb 100644 --- a/tests/APIExerciser.py +++ b/tests/APIExerciser.py @@ -18,7 +18,7 @@ def createURLs(): for x in range(0, randint(20, 100)): name = "DEBUG_API" if randint(0, 5) == 5: - name = "" #this link will fail + name = "" #: this link will fail urls.append(name + "".join(sample(string.ascii_letters, randint(10, 20)))) @@ -42,7 +42,7 @@ class APIExerciser(Thread): Thread.__init__(self) self.setDaemon(True) self.core = core - self.count = 0 #number of methods + self.count = 0 #: number of methods self.time = time() if thrift: @@ -81,7 +81,7 @@ class APIExerciser(Thread): if not self.count % 1000: out.flush() - if not sumCalled % 1000: #not thread safe + if not sumCalled % 1000: #: not thread safe self.core.log.info("Exercisers tested %d api calls" % sumCalled) persec = sumCalled / (time() - self.time) self.core.log.info("Approx. %.2f calls per second." % persec) |