diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-08-02 15:17:24 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-08-02 15:17:24 +0200 |
commit | 58f38f399387b44b956e785e1d578d0f621354e6 (patch) | |
tree | 8e9a6bb9f659db8f58d73b0c416572a8212abfcf | |
parent | youtube, new file format (diff) | |
download | pyload-58f38f399387b44b956e785e1d578d0f621354e6.tar.xz |
fixes, cleanup, summary for each package
26 files changed, 236 insertions, 294 deletions
diff --git a/module/Api.py b/module/Api.py index e7638560e..18aaf7460 100644 --- a/module/Api.py +++ b/module/Api.py @@ -45,7 +45,7 @@ class Api(Iface): def _convertPyFile(self, p): f = FileData(p["id"], p["url"], p["name"], p["plugin"], p["size"], p["format_size"], p["status"], p["statusmsg"], - p["package"], p["error"], p["order"], p["progress"]) + p["package"], p["error"], p["order"]) return f def _convertConfigFormat(self, c): @@ -77,9 +77,11 @@ class Api(Iface): :return: config value as string """ if section == "core": - return self.core.config[category][option] - elif section == "plugin": - return self.core.config.getPlugin(category, option) + value = self.core.config[category][option] + else: + value = self.core.config.getPlugin(category, option) + + return str(value) if type(value) != basestring else value def setConfigValue(self, category, option, value, section="core"): """Set new config value. @@ -371,11 +373,12 @@ class Api(Iface): :return: `PackageData` with .links attribute """ data = self.core.files.getPackageData(int(pid)) + if not data: raise PackageDoesNotExists(pid) pdata = PackageData(data["id"], data["name"], data["folder"], data["site"], data["password"], - data["queue"], data["order"], data["priority"], + data["queue"], data["order"], links=[self._convertPyFile(x) for x in data["links"].itervalues()]) return pdata @@ -387,11 +390,12 @@ class Api(Iface): :return: `PackageData` with .fid attribute """ data = self.core.files.getPackageData(int(pid)) + print data if not data: raise PackageDoesNotExists(pid) pdata = PackageData(data["id"], data["name"], data["folder"], data["site"], data["password"], - data["queue"], data["order"], data["priority"], + data["queue"], data["order"], fids=[int(x) for x in data["links"]]) return pdata @@ -403,6 +407,9 @@ class Api(Iface): :return: `FileData` """ info = self.core.files.getFileData(int(fid)) + if not info: + raise FileDoesNotExists(fid) + fdata = self._convertPyFile(info.values()[0]) return fdata @@ -433,8 +440,9 @@ class Api(Iface): :return: list of `PackageInfo` """ return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], pack["priority"], - fids=[int(x) for x in pack["links"]]) + pack["password"], pack["queue"], pack["order"], + pack["linksdone"], pack["sizedone"], pack["sizetotal"], + pack["linkstotal"]) for pack in self.core.files.getInfoData(Destination.Queue).itervalues()] def getQueueData(self): @@ -444,7 +452,8 @@ class Api(Iface): :return: list of `PackageData` """ return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], pack["priority"], + pack["password"], pack["queue"], pack["order"], + pack["linksdone"], pack["sizedone"], pack["sizetotal"], links=[self._convertPyFile(x) for x in pack["links"].itervalues()]) for pack in self.core.files.getCompleteData(Destination.Queue).itervalues()] @@ -454,8 +463,9 @@ class Api(Iface): :return: list of `PackageInfo` """ return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], pack["priority"], - fids=[int(x) for x in pack["links"]]) + pack["password"], pack["queue"], pack["order"], + pack["linksdone"], pack["sizedone"], pack["sizetotal"], + pack["linkstotal"]) for pack in self.core.files.getInfoData(Destination.Collector).itervalues()] def getCollectorData(self): @@ -464,7 +474,8 @@ class Api(Iface): :return: list of `PackageInfo` """ return [PackageData(pack["id"], pack["name"], pack["folder"], pack["site"], - pack["password"], pack["queue"], pack["order"], pack["priority"], + pack["password"], pack["queue"], pack["order"], + pack["linksdone"], pack["sizedone"], pack["sizetotal"], links=[self._convertPyFile(x) for x in pack["links"].itervalues()]) for pack in self.core.files.getCompleteData(Destination.Collector).itervalues()] @@ -554,6 +565,17 @@ class Api(Iface): if destination not in (0, 1): return self.core.files.setPackageLocation(pid, destination) + def moveFiles(self, fids, pid): + """Move multiple files to another package + + :param fids: list of file ids + :param pid: destination package + :return: + """ + #TODO: implement + pass + + def uploadContainer(self, filename, data): """Uploads and adds a container file to pyLoad. @@ -566,15 +588,6 @@ class Api(Iface): self.addPackage(th.name, [th.name], Destination.Queue) - def setPriority(self, pid, priority): - """Set a new priority, so a package will be downloaded before others. - - :param pid: package id - :param priority: - """ - p = self.core.files.getPackage(pid) - p.setPriority(priority) - def orderPackage(self, pid, position): """Gives a package a new position. diff --git a/module/Progress.py b/module/Progress.py deleted file mode 100644 index 1ce4903a4..000000000 --- a/module/Progress.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - @author: mkaay -""" - -class Progress: - def __init__(self, maximum=0, minimum=100): - self.maximum = maximum - self.minimum = minimum - self.value = 0 - self.notify = None - - def setRange(self, maximum, minimum): - self.maximum = maximum - self.minimum = minimum - - def setValue(self, value): - if not value == self.value: - self.value = value - if self.notify: - self.notify() - - def getPercent(self): - try: - return int(self.value) - except: - return 0 diff --git a/module/PyFile.py b/module/PyFile.py index 9390c9cca..07347fb93 100644 --- a/module/PyFile.py +++ b/module/PyFile.py @@ -18,7 +18,6 @@ """ from module.PullEvents import UpdateEvent -from module.Progress import Progress from module.utils import formatSize, lock from time import sleep, time @@ -53,7 +52,7 @@ class PyFile(object): """ __slots__ = ("m", "id", "url", "name", "size", "_size", "status", "pluginname", "packageid", "error", "order", "lock", "plugin", "waitUntil", "active", "abort", - "reconnected", "progress", "pluginmodule", "pluginclass") + "reconnected", "progress", "maxprogress", "pluginmodule", "pluginclass") def __init__(self, manager, id, url, name, size, status, error, pluginname, package, order): self.m = manager @@ -81,11 +80,8 @@ class PyFile(object): self.abort = False self.reconnected = False - self.progress = Progress() - if self.status in (0, 4): - self.progress.setValue(100) - - self.progress.notify = self.notifyChange + self.progress = 0 + self.maxprogress = 100 self.m.cache[int(id)] = self @@ -118,8 +114,6 @@ class PyFile(object): def setStatus(self, status): self.status = statusMap[status] - if self.status in (0, 4): - self.progress.setValue(100) self.sync() #@TODO needed aslong no better job approving exists def hasStatus(self, status): @@ -139,9 +133,6 @@ class PyFile(object): if hasattr(self, "plugin") and self.plugin: self.plugin.clean() del self.plugin - if hasattr(self.progress, "notify"): - del self.progress.notify - self.progress.notify = None self.m.releaseLink(self.id) @@ -175,8 +166,7 @@ class PyFile(object): 'statusmsg': self.m.statusMsg[self.status], 'package': self.packageid, 'error': self.error, - 'order': self.order, - 'progress': self.progress.getPercent(), + 'order': self.order } } @@ -252,10 +242,13 @@ class PyFile(object): def getPercent(self): """ get % of download """ - try: - return self.plugin.req.percent - except: - return 0 + if self.status == 12: + try: + return self.plugin.req.percent + except: + return 0 + else: + return self.progress def getSize(self): """ get size of download """ @@ -270,3 +263,8 @@ class PyFile(object): def notifyChange(self): e = UpdateEvent("file", self.id, "collector" if not self.package().queue else "queue") self.m.core.pullManager.addEvent(e) + + def setProgress(self, value): + if not value == self.progress: + self.progress = value + self.notifyChange() diff --git a/module/PyPackage.py b/module/PyPackage.py index bc9b8094f..991b18e54 100644 --- a/module/PyPackage.py +++ b/module/PyPackage.py @@ -23,7 +23,7 @@ class PyPackage(): """ Represents a package object at runtime """ - def __init__(self, manager, id, name, folder, site, password, queue, order, priority): + def __init__(self, manager, id, name, folder, site, password, queue, order): self.m = manager self.m.packageCache[int(id)] = self @@ -34,7 +34,6 @@ class PyPackage(): self.password = password self.queue = queue self.order = order - self.priority = priority self.setFinished = False @@ -53,7 +52,6 @@ class PyPackage(): 'password': self.password, 'queue': self.queue, 'order': self.order, - 'priority': self.priority, 'links': {} } } @@ -61,10 +59,6 @@ class PyPackage(): def getChildren(self): """get information about contained links""" return self.m.getPackageData(self.id)["links"] - - def setPriority(self, priority): - self.priority = priority - self.sync() def sync(self): """sync with db""" diff --git a/module/common/APIExerciser.py b/module/common/APIExerciser.py index d86e7266b..7cc30c6a1 100644 --- a/module/common/APIExerciser.py +++ b/module/common/APIExerciser.py @@ -25,11 +25,20 @@ def createURLs(): AVOID = (0,3,8) +idPool = 0 +sumCalled = 0 + + +def startApiExerciser(core, n): + for i in range(n): + APIExerciser(core) + class APIExerciser(Thread): - idPool = 0 def __init__(self, core, thrift=False): + global idPool + Thread.__init__(self) self.setDaemon(True) self.core = core @@ -43,10 +52,10 @@ class APIExerciser(Thread): self.api = core.api - self.id = self.idPool + self.id = idPool self.core.log.info("API Excerciser started %d" % self.id) - APIExerciser.idPool += 1 + idPool += 1 self.start() @@ -68,16 +77,24 @@ class APIExerciser(Thread): if not self.count % 100: self.core.log.info("Exerciser %d tested %d api calls" % (self.id, self.count)) if not self.count % 1000: - out.write("Tested %s api calls\n" % self.count) out.flush() + + 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) + self.core.log.info("Approx. %.2f ms per call." % (1000 / persec)) self.core.log.info("Collected garbage: %d" % gc.collect()) #sleep(random() / 500) def testAPI(self): + global sumCalled + m = ["statusDownloads", "statusServer", "addPackage", "getPackageData", "getFileData", "deleteFiles", - "deletePackages", "getQueue", "getCollector", "getQueueData", "getCollectorData", "isCaptchaWaiting"] + "deletePackages", "getQueue", "getCollector", "getQueueData", "getCollectorData", "isCaptchaWaiting", + "getCaptchaTask", "stopAllDownloads", "getAllInfo", "getServices" , "getAccounts", "getAllUserData"] method = choice(m) #print "Testing:", method @@ -88,6 +105,7 @@ class APIExerciser(Thread): res = getattr(self.api, method)() self.count += 1 + sumCalled += 1 #print res @@ -129,4 +147,7 @@ class APIExerciser(Thread): def getPackageData(self): info = self.api.getQueue() if info: - self.api.getPackageData(choice(info).pid)
\ No newline at end of file + self.api.getPackageData(choice(info).pid) + + def getAccounts(self): + self.api.getAccounts(False)
\ No newline at end of file diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py index 534b5a53c..812575a91 100644 --- a/module/database/DatabaseBackend.py +++ b/module/database/DatabaseBackend.py @@ -138,6 +138,8 @@ class DatabaseBackend(Thread): self._convertDB(convert) self._createTables() + self._migrateUser() + self.conn.commit() self.setuplock.set() @@ -210,29 +212,18 @@ class DatabaseBackend(Thread): def _createTables(self): """create tables for database""" - self.c.execute('CREATE TABLE IF NOT EXISTS "packages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "folder" TEXT, "password" TEXT DEFAULT "", "site" TEXT DEFAULT "", "queue" INTEGER DEFAULT 0 NOT NULL, "packageorder" INTEGER DEFAULT 0 NOT NULL, "priority" INTEGER DEFAULT 0 NOT NULL)') + self.c.execute('CREATE TABLE IF NOT EXISTS "packages" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "folder" TEXT, "password" TEXT DEFAULT "", "site" TEXT DEFAULT "", "queue" INTEGER DEFAULT 0 NOT NULL, "packageorder" INTEGER DEFAULT 0 NOT NULL)') self.c.execute('CREATE TABLE IF NOT EXISTS "links" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "url" TEXT NOT NULL, "name" TEXT, "size" INTEGER DEFAULT 0 NOT NULL, "status" INTEGER DEFAULT 3 NOT NULL, "plugin" TEXT DEFAULT "BasePlugin" NOT NULL, "error" TEXT DEFAULT "", "linkorder" INTEGER DEFAULT 0 NOT NULL, "package" INTEGER DEFAULT 0 NOT NULL, FOREIGN KEY(package) REFERENCES packages(id))') self.c.execute('CREATE INDEX IF NOT EXISTS "pIdIndex" ON links(package)') self.c.execute('CREATE TABLE IF NOT EXISTS "storage" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "identifier" TEXT NOT NULL, "key" TEXT NOT NULL, "value" TEXT DEFAULT "")') self.c.execute('CREATE TABLE IF NOT EXISTS "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "email" TEXT DEFAULT "" NOT NULL, "password" TEXT NOT NULL, "role" INTEGER DEFAULT 0 NOT NULL, "permission" INTEGER DEFAULT 0 NOT NULL, "template" TEXT DEFAULT "default" NOT NULL)') - - if exists("pyload.db"): - try: - self.core.log.info(_("Converting old Django DB")) - except: - print "Converting old Django DB" - conn = sqlite3.connect('pyload.db') - c = conn.cursor() - c.execute("SELECT username, password, email from auth_user WHERE is_superuser") - users = [] - for r in c: - pw = r[1].split("$") - users.append((r[0], pw[1] + pw[2], r[2])) - c.close() - conn.close() - - self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users) - move("pyload.db", "pyload.old.db") + + self.c.execute('CREATE VIEW IF NOT EXISTS "pstats" AS \ + SELECT p.id, SUM(l.size) AS sizetotal, COUNT(l.id) AS linkstotal, linksdone, sizedone\ + FROM packages p JOIN links l ON p.id = l.package LEFT OUTER JOIN\ + (SELECT p.id, COUNT(*) AS linksdone, SUM(l.size) AS sizedone \ + FROM packages p JOIN links l ON p.id = l.package AND l.status in (0,4,13) GROUP BY p.id) s ON s.id = p.id \ + GROUP BY p.id') #try to lower ids self.c.execute('SELECT max(id) FROM LINKS') @@ -254,6 +245,25 @@ class DatabaseBackend(Thread): self.c.execute('VACUUM') + + def _migrateUser(self): + if exists("pyload.db"): + try: + self.core.log.info(_("Converting old Django DB")) + except: + print "Converting old Django DB" + conn = sqlite3.connect('pyload.db') + c = conn.cursor() + c.execute("SELECT username, password, email from auth_user WHERE is_superuser") + users = [] + for r in c: + pw = r[1].split("$") + users.append((r[0], pw[1] + pw[2], r[2])) + c.close() + conn.close() + + self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users) + move("pyload.db", "pyload.old.db") def createCursor(self): return self.conn.cursor() diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py index 9b2a2c67e..70f814c51 100644 --- a/module/database/FileDatabase.py +++ b/module/database/FileDatabase.py @@ -95,12 +95,12 @@ class FileHandler: data = self.db.getAllLinks(queue) packs = self.db.getAllPackages(queue) - data.update([(str(x.id), x.toDbDict()[x.id]) for x in self.cache.values()]) - packs.update([(str(x.id), x.toDict()[x.id]) for x in self.packageCache.values() if x.queue == queue]) + data.update([(x.id, x.toDbDict()[x.id]) for x in self.cache.values()]) + packs.update([(x.id, x.toDict()[x.id]) for x in self.packageCache.values() if x.queue == queue]) for key, value in data.iteritems(): - if str(value["package"]) in packs: - packs[str(value["package"])]["links"][key] = value + if value["package"] in packs: + packs[value["package"]]["links"][key] = value return packs @@ -109,7 +109,9 @@ class FileHandler: """gets a data representation without links""" packs = self.db.getAllPackages(queue) - packs.update([(str(x.id), x.toDict()[x.id]) for x in self.packageCache.itervalues() if x.queue == queue]) + for x in self.packageCache.itervalues(): + if x.queue != queue or x.id not in packs: continue + packs[x.id].update(x.toDict()[x.id]) return packs @@ -249,7 +251,7 @@ class FileHandler: cache = self.cache.values() for x in cache: if int(x.toDbDict()[x.id]["package"]) == int(id): - tmplist.append((str(x.id), x.toDbDict()[x.id])) + tmplist.append((x.id, x.toDbDict()[x.id])) data.update(tmplist) pack["links"] = data @@ -461,7 +463,7 @@ class FileHandler: @change def reorderFile(self, id, position): f = self.getFileData(id) - f = f[str(id)] + f = f[id] e = RemoveEvent("file", id, "collector" if not self.getPackage(f["package"]).queue else "queue") self.core.pullManager.addEvent(e) @@ -533,7 +535,7 @@ class FileHandler: deleted = [] for id in old_packs.iterkeys(): - if str(id) not in new_packs: + if id not in new_packs: deleted.append(id) self.deletePackage(int(id)) @@ -633,7 +635,7 @@ class FileMethods(): self.c.execute('SELECT l.id,l.url,l.name,l.size,l.status,l.error,l.plugin,l.package,l.linkorder FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? ORDER BY l.linkorder', (q,)) data = {} for r in self.c: - data[str(r[0])] = { + data[r[0]] = { 'id': r[0], 'url': r[1], 'name': r[2], @@ -645,7 +647,6 @@ class FileMethods(): 'plugin': r[6], 'package': r[7], 'order': r[8], - 'progress': 100 if r[4] in (0, 4) else 0 } return data @@ -664,11 +665,13 @@ class FileMethods(): id: {'name': name ... 'links': {} }, ... } """ - self.c.execute('SELECT id,name,folder,site,password,queue,packageorder,priority FROM packages WHERE queue=? ORDER BY packageorder', str(q)) + self.c.execute('SELECT p.id, p.name, p.folder, p.site, p.password, p.queue, p.packageorder, s.sizetotal, s.sizedone, s.linksdone, s.linkstotal \ + FROM packages p JOIN pstats s ON p.id = s.id \ + WHERE p.queue=? ORDER BY p.packageorder', str(q)) data = {} for r in self.c: - data[str(r[0])] = { + data[r[0]] = { 'id': r[0], 'name': r[1], 'folder': r[2], @@ -676,7 +679,10 @@ class FileMethods(): 'password': r[4], 'queue': r[5], 'order': r[6], - 'priority': r[7], + 'sizetotal': int(r[7]), + 'sizedone': r[8] if r[8] else 0, #these can be None + 'linksdone': r[9] if r[9] else 0, + 'linkstotal': r[10], 'links': {} } @@ -690,7 +696,7 @@ class FileMethods(): r = self.c.fetchone() if not r: return None - data[str(r[0])] = { + data[r[0]] = { 'id': r[0], 'url': r[1], 'name': r[2], @@ -702,19 +708,18 @@ class FileMethods(): 'plugin': r[6], 'package': r[7], 'order': r[8], - 'progress': 100 if r[4] in (0, 4) else 0 } return data @style.queue def getPackageData(self, id): - """get package data""" + """get data about links for a package""" self.c.execute('SELECT id,url,name,size,status,error,plugin,package,linkorder FROM links WHERE package=? ORDER BY linkorder', (str(id), )) data = {} for r in self.c: - data[str(r[0])] = { + data[r[0]] = { 'id': r[0], 'url': r[1], 'name': r[2], @@ -726,7 +731,6 @@ class FileMethods(): 'plugin': r[6], 'package': r[7], 'order': r[8], - 'progress': 100 if r[4] in (0, 4) else 0 } return data @@ -738,7 +742,7 @@ class FileMethods(): @style.queue def updatePackage(self, p): - self.c.execute('UPDATE packages SET name=?,folder=?,site=?,password=?,queue=?,priority=? WHERE id=?', (p.name, p.folder, p.site, p.password, p.queue, p.priority, str(p.id))) + self.c.execute('UPDATE packages SET name=?,folder=?,site=?,password=?,queue=? WHERE id=?', (p.name, p.folder, p.site, p.password, p.queue, str(p.id))) @style.queue def updateLinkInfo(self, data): @@ -789,7 +793,7 @@ class FileMethods(): @style.queue def getPackage(self, id): """return package instance from id""" - self.c.execute("SELECT name,folder,site,password,queue,packageorder,priority FROM packages WHERE id=?", (str(id), )) + self.c.execute("SELECT name,folder,site,password,queue,packageorder FROM packages WHERE id=?", (str(id), )) r = self.c.fetchone() if not r: return None return PyPackage(self.manager, id, * r) @@ -818,7 +822,7 @@ class FileMethods(): cmd += ")" - cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE ((p.queue=1 AND l.plugin NOT IN %s) OR l.plugin IN %s) AND l.status IN (2,3,6,14) ORDER BY p.priority DESC, p.packageorder ASC, l.linkorder ASC LIMIT 5" % (cmd, pre) + cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE ((p.queue=1 AND l.plugin NOT IN %s) OR l.plugin IN %s) AND l.status IN (2,3,6,14) ORDER BY p.packageorder ASC, l.linkorder ASC LIMIT 5" % (cmd, pre) self.c.execute(cmd) # very bad! @@ -827,7 +831,7 @@ class FileMethods(): @style.queue def getPluginJob(self, plugins): """returns pyfile ids with suited plugins""" - cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE l.plugin IN %s AND l.status IN (2,3,6,14) ORDER BY p.priority DESC, p.packageorder ASC, l.linkorder ASC LIMIT 5" % plugins + cmd = "SELECT l.id FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE l.plugin IN %s AND l.status IN (2,3,6,14) ORDER BY p.packageorder ASC, l.linkorder ASC LIMIT 5" % plugins self.c.execute(cmd) # very bad! diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index c1b6684af..94e2b0aca 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -456,7 +456,7 @@ class Plugin(object): try: newname = self.req.httpDownload(url, filename, get=get, post=post, ref=ref, cookies=cookies, chunks=self.getChunkCount(), resume=self.resumeDownload, - progressNotify=self.pyfile.progress.setValue, disposition=disposition) + progressNotify=self.pyfile.setProgress, disposition=disposition) finally: self.pyfile.size = self.req.size diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index d7da2f93b..301b033d4 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -13,7 +13,7 @@ from os.path import exists, join class CCF(Container): __name__ = "CCF" __version__ = "0.2" - __pattern__ = r"(?!http://).*\.ccf" + __pattern__ = r"(?!http://).*\.ccf$" __description__ = """CCF Container Convert Plugin""" __author_name__ = ("Willnix") __author_mail__ = ("Willnix@pyload.org") diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index b4c98df08..02d343096 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -67,7 +67,6 @@ class MergeFiles(Hook): self.core.log.debug("Merging part %s" % splitted_file) pyfile = self.core.files.getFile(fid_dict[splitted_file]) pyfile.setStatus("processing") - pyfile.progress.setRange(0, 100) try: s_file = open(os.path.join(download_folder, splitted_file), "rb") size_written = 0 @@ -77,7 +76,7 @@ class MergeFiles(Hook): if f_buffer: final_file.write(f_buffer) size_written += BUFFER_SIZE - pyfile.progress.setValue((size_written*100)/s_file_size) + pyfile.setProgress((size_written*100)/s_file_size) else: break s_file.close() @@ -85,7 +84,7 @@ class MergeFiles(Hook): except Exception, e: print traceback.print_exc() finally: - pyfile.progress.setValue(100) + pyfile.setProgress(100) pyfile.setStatus("finished") pyfile.release() diff --git a/module/plugins/hooks/UnRar.py b/module/plugins/hooks/UnRar.py index c636664ee..778ae669c 100644 --- a/module/plugins/hooks/UnRar.py +++ b/module/plugins/hooks/UnRar.py @@ -149,10 +149,9 @@ class UnRar(Hook): self.core.log.info(_("starting Unrar of %s") % fname) pyfile = self.core.files.getFile(fid) pyfile.setStatus("processing") - pyfile.progress.setRange(0, 100) def s(p): - pyfile.progress.setValue(p) + pyfile.setProgress(p) download_folder = self.core.config['general']['download_folder'] self.core.log.debug(_("download folder %s") % download_folder) @@ -237,7 +236,7 @@ class UnRar(Hook): else: self.core.log.info(_("Unrar of %s failed (wrong password or bad parts)") % fname) finally: - pyfile.progress.setValue(100) + pyfile.setProgress(100) pyfile.setStatus("finished") pyfile.release() diff --git a/module/remote/thriftbackend/ThriftClient.py b/module/remote/thriftbackend/ThriftClient.py index c8e8f2bd7..3b6a56448 100644 --- a/module/remote/thriftbackend/ThriftClient.py +++ b/module/remote/thriftbackend/ThriftClient.py @@ -105,4 +105,6 @@ if __name__ == "__main__": print client.getServices() print client.call(Pyload.ServiceCall("UpdateManager", "recheckForUpdates")) + print client.getConfigValue("download", "limit_speed", "core") + client.close()
\ No newline at end of file diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index ebe1890e3..00f24f3fa 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -92,8 +92,7 @@ struct FileData { 8: string statusmsg, 9: PackageID packageID, 10: string error, - 11: i16 order, - 12: Progress progress + 11: i16 order } struct PackageData { @@ -104,9 +103,12 @@ struct PackageData { 5: string password, 6: Destination dest, 7: i16 order, - 8: Priority priority, - 9: optional list<FileID> fids, - 10: optional list<FileData> links + 8: optional i16 linksdone, + 9: optional i64 sizedone, + 10: optional i64 sizetotal, + 11: optional i16 linkstotal, + 12: optional list<FileData> links, + 13: optional list<FileID> fids } struct CaptchaTask { @@ -256,7 +258,7 @@ service Pyload { void stopDownloads(1: list<FileID> fids), void setPackageName(1: PackageID pid, 2: string name), void movePackage(1: Destination destination, 2: PackageID pid), - void setPriority(1: PackageID pid, 2: Priority priority) + void moveFiles(1: list<FileID> fids, 2: PackageID pid), void orderPackage(1: PackageID pid, 2: i16 position), void orderFile(1: FileID fid, 2: i16 position), void setPackageData(1: PackageID pid, 2: map<string, string> data) throws (1: PackageDoesNotExists e), diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote index 8c2b368e1..fd48556dd 100755 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -70,7 +70,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' void stopDownloads( fids)' print ' void setPackageName(PackageID pid, string name)' print ' void movePackage(Destination destination, PackageID pid)' - print ' void setPriority(PackageID pid, Priority priority)' + print ' void moveFiles( fids, PackageID pid)' print ' void orderPackage(PackageID pid, i16 position)' print ' void orderFile(FileID fid, i16 position)' print ' void setPackageData(PackageID pid, data)' @@ -424,11 +424,11 @@ elif cmd == 'movePackage': sys.exit(1) pp.pprint(client.movePackage(eval(args[0]),eval(args[1]),)) -elif cmd == 'setPriority': +elif cmd == 'moveFiles': if len(args) != 2: - print 'setPriority requires 2 args' + print 'moveFiles requires 2 args' sys.exit(1) - pp.pprint(client.setPriority(eval(args[0]),eval(args[1]),)) + pp.pprint(client.moveFiles(eval(args[0]),eval(args[1]),)) elif cmd == 'orderPackage': if len(args) != 2: diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py index 816c6e7d1..ef2b037d5 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py @@ -280,11 +280,11 @@ class Iface(object): """ pass - def setPriority(self, pid, priority): + def moveFiles(self, fids, pid): """ Parameters: + - fids - pid - - priority """ pass @@ -1743,32 +1743,32 @@ class Client(Iface): self._iprot.readMessageEnd() return - def setPriority(self, pid, priority): + def moveFiles(self, fids, pid): """ Parameters: + - fids - pid - - priority """ - self.send_setPriority(pid, priority) - self.recv_setPriority() + self.send_moveFiles(fids, pid) + self.recv_moveFiles() - def send_setPriority(self, pid, priority): - self._oprot.writeMessageBegin('setPriority', TMessageType.CALL, self._seqid) - args = setPriority_args() + def send_moveFiles(self, fids, pid): + self._oprot.writeMessageBegin('moveFiles', TMessageType.CALL, self._seqid) + args = moveFiles_args() + args.fids = fids args.pid = pid - args.priority = priority args.write(self._oprot) self._oprot.writeMessageEnd() self._oprot.trans.flush() - def recv_setPriority(self, ): + def recv_moveFiles(self, ): (fname, mtype, rseqid) = self._iprot.readMessageBegin() if mtype == TMessageType.EXCEPTION: x = TApplicationException() x.read(self._iprot) self._iprot.readMessageEnd() raise x - result = setPriority_result() + result = moveFiles_result() result.read(self._iprot) self._iprot.readMessageEnd() return @@ -2437,7 +2437,7 @@ class Processor(Iface, TProcessor): self._processMap["stopDownloads"] = Processor.process_stopDownloads self._processMap["setPackageName"] = Processor.process_setPackageName self._processMap["movePackage"] = Processor.process_movePackage - self._processMap["setPriority"] = Processor.process_setPriority + self._processMap["moveFiles"] = Processor.process_moveFiles self._processMap["orderPackage"] = Processor.process_orderPackage self._processMap["orderFile"] = Processor.process_orderFile self._processMap["setPackageData"] = Processor.process_setPackageData @@ -3001,13 +3001,13 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() - def process_setPriority(self, seqid, iprot, oprot): - args = setPriority_args() + def process_moveFiles(self, seqid, iprot, oprot): + args = moveFiles_args() args.read(iprot) iprot.readMessageEnd() - result = setPriority_result() - self._handler.setPriority(args.pid, args.priority) - oprot.writeMessageBegin("setPriority", TMessageType.REPLY, seqid) + result = moveFiles_result() + self._handler.moveFiles(args.fids, args.pid) + oprot.writeMessageBegin("moveFiles", TMessageType.REPLY, seqid) result.write(oprot) oprot.writeMessageEnd() oprot.trans.flush() @@ -4709,30 +4709,30 @@ class movePackage_result(TBase): ) -class setPriority_args(TBase): +class moveFiles_args(TBase): """ Attributes: + - fids - pid - - priority """ __slots__ = [ + 'fids', 'pid', - 'priority', ] thrift_spec = ( None, # 0 - (1, TType.I32, 'pid', None, None, ), # 1 - (2, TType.BYTE, 'priority', None, None, ), # 2 + (1, TType.LIST, 'fids', (TType.I32,None), None, ), # 1 + (2, TType.I32, 'pid', None, None, ), # 2 ) - def __init__(self, pid=None, priority=None,): + def __init__(self, fids=None, pid=None,): + self.fids = fids self.pid = pid - self.priority = priority -class setPriority_result(TBase): +class moveFiles_result(TBase): __slots__ = [ ] diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py index e5d22805e..199279dda 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -291,7 +291,6 @@ class FileData(TBase): - packageID - error - order - - progress """ __slots__ = [ @@ -306,7 +305,6 @@ class FileData(TBase): 'packageID', 'error', 'order', - 'progress', ] thrift_spec = ( @@ -322,10 +320,9 @@ class FileData(TBase): (9, TType.I32, 'packageID', None, None, ), # 9 (10, TType.STRING, 'error', None, None, ), # 10 (11, TType.I16, 'order', None, None, ), # 11 - (12, TType.BYTE, 'progress', None, None, ), # 12 ) - def __init__(self, fid=None, url=None, name=None, plugin=None, size=None, format_size=None, status=None, statusmsg=None, packageID=None, error=None, order=None, progress=None,): + def __init__(self, fid=None, url=None, name=None, plugin=None, size=None, format_size=None, status=None, statusmsg=None, packageID=None, error=None, order=None,): self.fid = fid self.url = url self.name = name @@ -337,7 +334,6 @@ class FileData(TBase): self.packageID = packageID self.error = error self.order = order - self.progress = progress class PackageData(TBase): @@ -350,9 +346,12 @@ class PackageData(TBase): - password - dest - order - - priority - - fids + - linksdone + - sizedone + - sizetotal + - linkstotal - links + - fids """ __slots__ = [ @@ -363,9 +362,12 @@ class PackageData(TBase): 'password', 'dest', 'order', - 'priority', - 'fids', + 'linksdone', + 'sizedone', + 'sizetotal', + 'linkstotal', 'links', + 'fids', ] thrift_spec = ( @@ -377,12 +379,15 @@ class PackageData(TBase): (5, TType.STRING, 'password', None, None, ), # 5 (6, TType.I32, 'dest', None, None, ), # 6 (7, TType.I16, 'order', None, None, ), # 7 - (8, TType.BYTE, 'priority', None, None, ), # 8 - (9, TType.LIST, 'fids', (TType.I32,None), None, ), # 9 - (10, TType.LIST, 'links', (TType.STRUCT,(FileData, FileData.thrift_spec)), None, ), # 10 + (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 ) - def __init__(self, pid=None, name=None, folder=None, site=None, password=None, dest=None, order=None, priority=None, fids=None, links=None,): + def __init__(self, pid=None, name=None, folder=None, site=None, password=None, dest=None, order=None, linksdone=None, sizedone=None, sizetotal=None, linkstotal=None, links=None, fids=None,): self.pid = pid self.name = name self.folder = folder @@ -390,9 +395,12 @@ class PackageData(TBase): self.password = password self.dest = dest self.order = order - self.priority = priority - self.fids = fids + self.linksdone = linksdone + self.sizedone = sizedone + self.sizetotal = sizetotal + self.linkstotal = linkstotal self.links = links + self.fids = fids class CaptchaTask(TBase): diff --git a/module/web/json_app.py b/module/web/json_app.py index 959b3d974..0573eff77 100644 --- a/module/web/json_app.py +++ b/module/web/json_app.py @@ -306,8 +306,7 @@ def edit_package(): id = int(request.forms.get("pack_id")) data = {"name": request.forms.get("pack_name").decode("utf8", "ignore"), "folder": request.forms.get("pack_folder").decode("utf8", "ignore"), - "priority": request.forms.get("pack_prio"), - "password": request.forms.get("pack_pws").decode("utf8", "ignore")} + "password": request.forms.get("pack_pws").decode("utf8", "ignore")} PYLOAD.setPackageData(id, data) return {"response": "success"} diff --git a/module/web/media/default/css/default.css b/module/web/media/default/css/default.css index 978aeadde..fc0d148c2 100644 --- a/module/web/media/default/css/default.css +++ b/module/web/media/default/css/default.css @@ -588,8 +588,8 @@ td p { }
.packagename {
font-weight: bold;
- text-transform: uppercase;
}
+
.child {
margin-left: 20px;
}
diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index 35203ad7b..8d76d39ec 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -163,7 +163,7 @@ def queue(): queue.sort(key=attrgetter("order")) - return render_to_response('queue.html', {'content': queue}, [pre_processor]) + return render_to_response('queue.html', {'content': queue, 'target': 1}, [pre_processor]) @route("/collector") @@ -173,7 +173,7 @@ def collector(): queue.sort(key=attrgetter("order")) - return render_to_response('collector.html', {'content': queue}, [pre_processor]) + return render_to_response('queue.html', {'content': queue, 'target': 0}, [pre_processor]) @route("/downloads") diff --git a/module/web/templates/default/collector.html b/module/web/templates/default/collector.html deleted file mode 100644 index 20221b899..000000000 --- a/module/web/templates/default/collector.html +++ /dev/null @@ -1,58 +0,0 @@ -{% extends 'default/base.html' %}
-{% block head %}
-
-<script type="text/javascript" src="/package_ui.js"></script>
-
-<script type="text/javascript">
-
-document.addEvent("domready", function(){
- var pUI = new PackageUI("url", 0);
-});
-</script>
-{% endblock %}
-
-{% block title %}{{_("Collector")}} - {{super()}} {% endblock %}
-{% block subtitle %}{{_("Collector")}}{% endblock %}
-
-{% block pageactions %}
-<ul id="page-actions-more">
- <li id="del_finished"><a style="padding: 0; font-weight: bold;" href="#">{{_("Delete Finished")}}</a></li>
- <li id="restart_failed"><a style="padding: 0; font-weight: bold;" href="#">{{_("Restart Failed")}}</a></li>
-</ul>
-{% endblock %}
-
-{% block content %}
-
-<ul id="package-list" style="list-style: none; padding-left: 0; margin-top: -10px;">
-{% for package in content %}
- <li>
-<div id="package_{{package.pid}}" class="package">
- <div class="order" style="display: none;">{{ package.order }}</div>
-
- <div class="packagename" style="cursor: pointer;">
- <img class="package_drag" src="/media/default/img/folder.png" style="cursor: move; margin-bottom: -2px">
- <span class="name">{{package.name}}</span>
-
- <span class="buttons" style="opacity:0">
- <img title="{{_("Delete Package")}}" style="cursor: pointer" width="12px" height="12px" src="/media/default/img/delete.png" />
-
- <img title="{{_("Restart Package")}}" style="margin-left: -10px; cursor: pointer" height="12px" src="/media/default/img/arrow_refresh.png" />
-
- <img title="{{_("Edit Package")}}" style="margin-left: -10px; cursor: pointer" height="12px" src="/media/default/img/pencil.png" />
-
- <img title="{{_("Move Package to Queue")}}" style="margin-left: -10px; cursor: pointer" height="12px" src="/media/default/img/package_go.png" />
- </span>
- </div>
- <div id="children_{{package.pid}}" style="display: none;" class="children">
- <span class="child_secrow">{{_("Folder:")}} <span class="folder">{{package.folder}}</span> | {{_("Password:")}} <span class="password">{{package.password}}</span> | {{_("Priority:")}} <span class="prio">{{package.priority}}</span></span>
- <ul id="sort_children_{{package.pid}}" style="list-style: none; padding-left: 0">
- </ul>
- </div>
-</div>
- </li>
-{% endfor %}
-</ul>
-
-{% include "default/edit_package.html" %}
-
-{% endblock %}
diff --git a/module/web/templates/default/edit_package.html b/module/web/templates/default/edit_package.html index 0c9dcff42..f02540aaa 100644 --- a/module/web/templates/default/edit_package.html +++ b/module/web/templates/default/edit_package.html @@ -13,19 +13,6 @@ </label>
<input id="pack_folder" name="pack_folder" type="text" size="20" />
-<label for="pack_prio">{{_("Priority")}}
-<span class="small">{{_("Priority of the package.")}}</span>
-</label>
- <select name="pack_prio" id="pack_prio">
- <option value="3">{{_("highest")}}</option>
- <option value="2">{{_("higher")}}</option>
- <option value="1">{{_("high")}}</option>
- <option value="0" selected="selected">{{_("normal")}}</option>
- <option value="-1">{{_("low")}}</option>
- <option value="-2">{{_("lower")}}</option>
- <option value="-3">{{_("lowest")}}</option>
- </select>
-
<label for="pack_pws">{{_("Password")}}
<span class="small">{{_("List of passwords used for unrar.")}}</span>
</label>
diff --git a/module/web/templates/default/package_ui.js b/module/web/templates/default/package_ui.js index 0b938910a..1d0e25dd6 100644 --- a/module/web/templates/default/package_ui.js +++ b/module/web/templates/default/package_ui.js @@ -176,7 +176,6 @@ var Package = new Class({ this.name = this.ele.getElements('.name')[0]; this.folder = this.ele.getElements('.folder')[0]; this.password = this.ele.getElements('.password')[0]; - this.prio = this.ele.getElements('.prio')[0]; imgs[1].addEvent('click', this.deletePackage.bind(this)); @@ -352,16 +351,6 @@ var Package = new Class({ $("pack_folder").set("value", this.folder.get("text")); $("pack_pws").set("value", this.password.get("text")); - var prio = 3; - $("pack_prio").getChildren("option").each(function(item, index) { - item.erase("selected"); - if (prio.toString() == this.prio.get("text")) { - item.set("selected", "selected"); - } - prio--; - }.bind(this)); - - show_pack(); event.stop(); }, @@ -371,7 +360,6 @@ var Package = new Class({ this.name.set("text", $("pack_name").get("value")); this.folder.set("text", $("pack_folder").get("value")); this.password.set("text", $("pack_pws").get("value")); - this.prio.set("text", $("pack_prio").get("value")); hide_pack(); event.stop(); }, diff --git a/module/web/templates/default/queue.html b/module/web/templates/default/queue.html index b9ec525a1..e1535a12e 100644 --- a/module/web/templates/default/queue.html +++ b/module/web/templates/default/queue.html @@ -6,13 +6,19 @@ <script type="text/javascript">
document.addEvent("domready", function(){
- var pUI = new PackageUI("url",1);
+ var pUI = new PackageUI("url", {{ target }});
});
</script>
{% endblock %}
-{% block title %}{{_("Queue")}} - {{super()}} {% endblock %}
-{% block subtitle %}{{_("Queue")}}{% endblock %}
+{% if target %}
+ {% set name = _("Queue") %}
+{% else %}
+ {% set name = _("Collector") %}
+{% endif %}
+
+{% block title %}{{name}} - {{super()}} {% endblock %}
+{% block subtitle %}{{name}}{% endblock %}
{% block pageactions %}
<ul id="page-actions-more">
@@ -23,14 +29,13 @@ document.addEvent("domready", function(){ {% block content %}
-
<ul id="package-list" style="list-style: none; padding-left: 0; margin-top: -10px;">
{% for package in content %}
<li>
<div id="package_{{package.pid}}" class="package">
<div class="order" style="display: none;">{{ package.order }}</div>
- <div class="packagename" style="cursor: pointer;">
+ <div class="packagename" style="cursor: pointer">
<img class="package_drag" src="/media/default/img/folder.png" style="cursor: move; margin-bottom: -2px">
<span class="name">{{package.name}}</span>
@@ -41,11 +46,22 @@ document.addEvent("domready", function(){
<img title="{{_("Edit Package")}}" style="margin-left: -10px; cursor: pointer" height="12px" src="/media/default/img/pencil.png" />
- <img title="{{_("Move Package to Collector")}}" style="margin-left: -10px; cursor: pointer" height="12px" src="/media/default/img/package_go.png" />
+ <img title="{{_("Move Package")}}" style="margin-left: -10px; cursor: pointer" height="12px" src="/media/default/img/package_go.png" />
</span>
</div>
+ {% set progress = (package.linksdone * 100) / package.linkstotal %}
+
+ <div id="progress" style="border-radius: 4px; border: 1px solid #AAAAAA; width: 50%; height: 1em">
+ <div style="width: {{ progress }}%; height: 100%; background-color: #add8e6;"></div>
+ <label style="font-size: 0.8em; font-weight: bold; padding-left: 5px; position: relative; top: -17px">
+ {{ package.sizedone|formatsize }} / {{ package.sizetotal|formatsize }}</label>
+ <label style="font-size: 0.8em; font-weight: bold; padding-right: 5px ;float: right; position: relative; top: -17px">
+ {{ package.linksdone }} / {{ package.linkstotal }}</label>
+ </div>
+ <div style="clear: both; margin-bottom: -10px"></div>
+
<div id="children_{{package.pid}}" style="display: none;" class="children">
- <span class="child_secrow">{{_("Folder:")}} <span class="folder">{{package.folder}}</span> | {{_("Password:")}} <span class="password">{{package.password}}</span> | {{_("Priority:")}} <span class="prio">{{package.priority}}</span></span>
+ <span class="child_secrow">{{_("Folder:")}} <span class="folder">{{package.folder}}</span> | {{_("Password:")}} <span class="password">{{package.password}}</span></span>
<ul id="sort_children_{{package.pid}}" style="list-style: none; padding-left: 0">
</ul>
</div>
diff --git a/module/web/webinterface.py b/module/web/webinterface.py index e54c8b137..4d07c436e 100644 --- a/module/web/webinterface.py +++ b/module/web/webinterface.py @@ -29,7 +29,7 @@ PYLOAD_DIR = abspath(join(PROJECT_DIR, "..", "..")) sys.path.append(PYLOAD_DIR) from module import InitHomeDir -from module.utils import decode +from module.utils import decode, formatSize import bottle from bottle import run, app @@ -81,6 +81,7 @@ env.filters["path_make_relative"] = path_make_relative env.filters["path_make_absolute"] = path_make_absolute env.filters["decode"] = decode env.filters["type"] = lambda x: str(type(x)) +env.filters["formatsize"] = formatSize translation = gettext.translation("django", join(PYLOAD_DIR, "locale"), diff --git a/pyLoadCli.py b/pyLoadCli.py index a7750f784..14ab64908 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -178,7 +178,7 @@ class Cli: line += 1 println(line, blue("[") + yellow(z * "#" + (25 - z) * " ") + blue("] ") + green(str(percent) + "%") + _( - " Speed: ") + green(formatSize(speed) + "/s") + _(" Size: ") + green( + " Speed: ") + green(formatSize(download.speed) + "/s") + _(" Size: ") + green( download.format_size) + _(" Finished in: ") + green(download.format_eta) + _( " ID: ") + green(download.fid)) line += 1 diff --git a/pyLoadCore.py b/pyLoadCore.py index 3e0979b57..4220db302 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -56,7 +56,7 @@ from module.database import DatabaseBackend from module.database import FileHandler -from module.utils import freeSpace, formatSize, compare_time +from module.utils import freeSpace, formatSize from codecs import getwriter if os.name == "nt": @@ -396,10 +396,9 @@ class Core(object): self.log.info(_("pyLoad is up and running")) #test api -# from module.common.APIExerciser import APIExerciser -# APIExerciser(self) -# APIExerciser(self) -# APIExerciser(self) +# from module.common.APIExerciser import startApiExerciser +# startApiExerciser(self, 3) + #some memory stats # from guppy import hpy # hp=hpy() |