diff options
Diffstat (limited to 'pyload')
44 files changed, 155 insertions, 418 deletions
| diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py index 0b63995a3..8c114cea4 100644 --- a/pyload/api/__init__.py +++ b/pyload/api/__init__.py @@ -118,9 +118,8 @@ class Api(Iface):                  section.outline = sub["outline"]          return sections -    @permission(PERMS.SETTINGS) - +    @permission(PERMS.SETTINGS)      def getConfigValue(self, category, option, section="core"):          """Retrieve config value. @@ -135,9 +134,8 @@ class Api(Iface):              value = self.core.config.getPlugin(category, option)          return str(value) -    @permission(PERMS.SETTINGS) - +    @permission(PERMS.SETTINGS)      def setConfigValue(self, category, option, value, section="core"):          """Set new config value. @@ -154,9 +152,8 @@ class Api(Iface):          elif section == "plugin":              self.core.config.setPlugin(category, option, value) -    @permission(PERMS.SETTINGS) - +    @permission(PERMS.SETTINGS)      def getConfig(self):          """Retrieves complete config of core. @@ -172,9 +169,8 @@ class Api(Iface):          """          return self.core.config.config -    @permission(PERMS.SETTINGS) - +    @permission(PERMS.SETTINGS)      def getPluginConfig(self):          """Retrieves complete config for all plugins. @@ -190,23 +186,20 @@ class Api(Iface):          """          return self.core.config.plugin -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def pauseServer(self):          """Pause server: Tt wont start any new downloads, but nothing gets aborted."""          self.core.threadManager.pause = True -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def unpauseServer(self):          """Unpause server: New Downloads will be started."""          self.core.threadManager.pause = False -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def togglePause(self):          """Toggle pause state. @@ -215,9 +208,8 @@ class Api(Iface):          self.core.threadManager.pause ^= True          return self.core.threadManager.pause -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def toggleReconnect(self):          """Toggle reconnect activation. @@ -226,9 +218,8 @@ class Api(Iface):          self.core.config["reconnect"]["activated"] ^= True          return self.core.config["reconnect"]["activated"] -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def statusServer(self):          """Some general information about the current status of pyLoad. @@ -242,16 +233,14 @@ class Api(Iface):              serverStatus.speed += pyfile.getSpeed()  # bytes/s          return serverStatus -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def freeSpace(self):          """Available free space at download directory in bytes"""          return freeSpace(self.core.config["general"]["download_folder"]) -    @permission(PERMS.ALL) - +    @permission(PERMS.ALL)      def getServerVersion(self):          """pyLoad Core version """          return self.core.version @@ -266,9 +255,8 @@ class Api(Iface):          """Restart pyload core"""          self.core.do_restart = True -    @permission(PERMS.LOGS) - +    @permission(PERMS.LOGS)      def getLog(self, offset=0):          """Returns most recent log entries. @@ -286,9 +274,8 @@ class Api(Iface):          except Exception:              return ['No log available'] -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def isTimeDownload(self):          """Checks if pyload will start new downloads according to time in config. @@ -298,9 +285,8 @@ class Api(Iface):          end = self.core.config['downloadTime']['end'].split(":")          return compare_time(start, end) -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def isTimeReconnect(self):          """Checks if pyload will try to make a reconnect @@ -310,9 +296,8 @@ class Api(Iface):          end = self.core.config['reconnect']['endTime'].split(":")          return compare_time(start, end) and self.core.config["reconnect"]["activated"] -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def statusDownloads(self):          """ Status off all currently running downloads. @@ -329,9 +314,8 @@ class Api(Iface):                  pyfile.waitUntil, pyfile.packageid, pyfile.package().name, pyfile.pluginname))          return data -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def addPackage(self, name, links, dest=Destination.Queue):          """Adds a package, with links to desired destination. @@ -357,9 +341,8 @@ class Api(Iface):          return pid -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def parseURLs(self, html=None, url=None):          """Parses html content or any arbitaty text for links and returns result of `checkURLs` @@ -375,9 +358,8 @@ class Api(Iface):          # remove duplicates          return self.checkURLs(set(urls)) -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def checkURLs(self, urls):          """ Gets urls and returns pluginname mapped to list of matches urls. @@ -395,9 +377,8 @@ class Api(Iface):          return plugins -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def checkOnlineStatus(self, urls):          """ initiates online status check @@ -418,9 +399,8 @@ class Api(Iface):          return OnlineCheck(rid, result) -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def checkOnlineStatusContainer(self, urls, container, data):          """ checks online status of urls and a submited container file @@ -434,9 +414,8 @@ class Api(Iface):          th.close()          return self.checkOnlineStatus(urls + [th.name]) -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def pollResults(self, rid):          """ Polls the result available for ResultID @@ -450,9 +429,8 @@ class Api(Iface):          else:              return OnlineCheck(rid, result) -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def generatePackages(self, links):          """ Parses links, generates packages names from urls @@ -461,9 +439,8 @@ class Api(Iface):          """          return parseNames((x, x) for x in links) -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def generateAndAddPackages(self, links, dest=Destination.Queue):          """Generates and add packages @@ -474,9 +451,8 @@ class Api(Iface):          return [self.addPackage(name, urls, dest) for name, urls                  in self.generatePackages(links).iteritems()] -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def checkAndAddPackages(self, links, dest=Destination.Queue):          """Checks online status, retrieves names, and will add packages.\          Because of this packages are not added immediatly, only for internal use. @@ -488,9 +464,8 @@ class Api(Iface):          data = self.core.pluginManager.parseUrls(links)          self.core.threadManager.createResultThread(data, True) -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getPackageData(self, pid):          """Returns complete information about package, and included files. @@ -504,9 +479,8 @@ class Api(Iface):                             data["queue"], data["order"],                             links=[self._convertPyFile(x) for x in data["links"].itervalues()]) -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getPackageInfo(self, pid):          """Returns information about package, without detailed information about containing files @@ -521,9 +495,8 @@ class Api(Iface):                             data["queue"], data["order"],                             fids=[int(x) for x in data["links"]]) -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getFileData(self, fid):          """Get complete information about a specific file. @@ -535,9 +508,8 @@ class Api(Iface):              raise FileDoesNotExists(fid)          return self._convertPyFile(info.values()[0]) -    @permission(PERMS.DELETE) - +    @permission(PERMS.DELETE)      def deleteFiles(self, fids):          """Deletes several file entries from pyload. @@ -547,9 +519,8 @@ class Api(Iface):              self.core.files.deleteLink(int(fid))          self.core.files.save() -    @permission(PERMS.DELETE) - +    @permission(PERMS.DELETE)      def deletePackages(self, pids):          """Deletes packages and containing links. @@ -559,9 +530,8 @@ class Api(Iface):              self.core.files.deletePackage(int(pid))          self.core.files.save() -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getQueue(self):          """Returns info about queue and packages, **not** about files, see `getQueueData` \          or `getPackageData` instead. @@ -574,9 +544,8 @@ class Api(Iface):                              pack["linkstotal"])                  for pack in self.core.files.getInfoData(Destination.Queue).itervalues()] -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getQueueData(self):          """Return complete data about everything in queue, this is very expensive use it sparely.\             See `getQueue` for alternative. @@ -589,9 +558,8 @@ class Api(Iface):                              links=[self._convertPyFile(x) for x in pack["links"].itervalues()])                  for pack in self.core.files.getCompleteData(Destination.Queue).itervalues()] -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getCollector(self):          """same as `getQueue` for collector. @@ -603,9 +571,8 @@ class Api(Iface):                              pack["linkstotal"])                  for pack in self.core.files.getInfoData(Destination.Collector).itervalues()] -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getCollectorData(self):          """same as `getQueueData` for collector. @@ -617,9 +584,8 @@ class Api(Iface):                              links=[self._convertPyFile(x) for x in pack["links"].itervalues()])                  for pack in self.core.files.getCompleteData(Destination.Collector).itervalues()] -    @permission(PERMS.ADD) - +    @permission(PERMS.ADD)      def addFiles(self, pid, links):          """Adds files to specific package. @@ -630,9 +596,8 @@ class Api(Iface):          self.core.log.info(_("Added %(count)d links to package #%(package)d ") % {"count": len(links), "package": pid})          self.core.files.save() -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def pushToQueue(self, pid):          """Moves package from Collector to Queue. @@ -640,9 +605,8 @@ class Api(Iface):          """          self.core.files.setPackageLocation(pid, Destination.Queue) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def pullFromQueue(self, pid):          """Moves package from Queue to Collector. @@ -650,9 +614,8 @@ class Api(Iface):          """          self.core.files.setPackageLocation(pid, Destination.Collector) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def restartPackage(self, pid):          """Restarts a package, resets every containing files. @@ -660,9 +623,8 @@ class Api(Iface):          """          self.core.files.restartPackage(int(pid)) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def restartFile(self, fid):          """Resets file status, so it will be downloaded again. @@ -670,9 +632,8 @@ class Api(Iface):          """          self.core.files.restartFile(int(fid)) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def recheckPackage(self, pid):          """Proofes online status of all files in a package, also a default action when package is added. @@ -681,9 +642,8 @@ class Api(Iface):          """          self.core.files.reCheckPackage(int(pid)) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def stopAllDownloads(self):          """Aborts all running downloads.""" @@ -691,9 +651,8 @@ class Api(Iface):          for pyfile in pyfiles:              pyfile.abortDownload() -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def stopDownloads(self, fids):          """Aborts specific downloads. @@ -705,9 +664,8 @@ class Api(Iface):              if pyfile.id in fids:                  pyfile.abortDownload() -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def setPackageName(self, pid, name):          """Renames a package. @@ -718,9 +676,8 @@ class Api(Iface):          pack.name = name          pack.sync() -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def movePackage(self, destination, pid):          """Set a new package location. @@ -730,9 +687,8 @@ class Api(Iface):          if destination in (0, 1):              self.core.files.setPackageLocation(pid, destination) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def moveFiles(self, fids, pid):          """Move multiple files to another package @@ -745,8 +701,6 @@ class Api(Iface):      @permission(PERMS.ADD) - -      def uploadContainer(self, filename, data):          """Uploads and adds a container file to pyLoad. @@ -758,9 +712,8 @@ class Api(Iface):          th.close()          self.addPackage(th.name, [th.name], Destination.Queue) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def orderPackage(self, pid, position):          """Gives a package a new position. @@ -769,9 +722,8 @@ class Api(Iface):          """          self.core.files.reorderPackage(pid, position) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def orderFile(self, fid, position):          """Gives a new position to a file within its package. @@ -780,9 +732,8 @@ class Api(Iface):          """          self.core.files.reorderFile(fid, position) -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def setPackageData(self, pid, data):          """Allows to modify several package attributes. @@ -799,9 +750,8 @@ class Api(Iface):          package.sync()          self.core.files.save() -    @permission(PERMS.DELETE) - +    @permission(PERMS.DELETE)      def deleteFinished(self):          """Deletes all finished files and completly finished packages. @@ -809,16 +759,14 @@ class Api(Iface):          """          return self.core.files.deleteFinishedLinks() -    @permission(PERMS.MODIFY) - +    @permission(PERMS.MODIFY)      def restartFailed(self):          """Restarts all failed failes."""          self.core.files.restartFailed() -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getPackageOrder(self, destination):          """Returns information about package order. @@ -834,9 +782,8 @@ class Api(Iface):              order[pack["order"]] = pack["id"]          return order -    @permission(PERMS.LIST) - +    @permission(PERMS.LIST)      def getFileOrder(self, pid):          """Information about file order within package. @@ -853,8 +800,6 @@ class Api(Iface):      @permission(PERMS.STATUS) - -      def isCaptchaWaiting(self):          """Indicates wether a captcha task is available @@ -864,9 +809,8 @@ class Api(Iface):          task = self.core.captchaManager.getTask()          return not task is None -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def getCaptchaTask(self, exclusive=False):          """Returns a captcha task @@ -882,9 +826,8 @@ class Api(Iface):              return ctask          return CaptchaTask(-1) -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def getCaptchaTaskStatus(self, tid):          """Get information about captcha task @@ -895,9 +838,8 @@ class Api(Iface):          task = self.core.captchaManager.getTaskByID(tid)          return task.getStatus() if task else "" -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def setCaptchaResult(self, tid, result):          """Set result for a captcha task @@ -910,9 +852,8 @@ class Api(Iface):              task.setResult(result)              self.core.captchaManager.removeTask(task) -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def getEvents(self, uuid):          """Lists occured events, may be affected to changes in future. @@ -943,9 +884,8 @@ class Api(Iface):              new_events.append(event)          return new_events -    @permission(PERMS.ACCOUNTS) - +    @permission(PERMS.ACCOUNTS)      def getAccounts(self, refresh):          """Get information about all entered accounts. @@ -959,9 +899,8 @@ class Api(Iface):                          for acc in group]          return accounts or [] -    @permission(PERMS.ALL) - +    @permission(PERMS.ALL)      def getAccountTypes(self):          """All available account types. @@ -969,16 +908,14 @@ class Api(Iface):          """          return self.core.accountManager.accounts.keys() -    @permission(PERMS.ACCOUNTS) - +    @permission(PERMS.ACCOUNTS)      def updateAccount(self, plugin, account, password=None, options=None):          """Changes pw/options for specific account."""          self.core.accountManager.updateAccount(plugin, account, password, options or {}) -    @permission(PERMS.ACCOUNTS) - +    @permission(PERMS.ACCOUNTS)      def removeAccount(self, plugin, account):          """Remove account from pyload. @@ -987,9 +924,8 @@ class Api(Iface):          """          self.core.accountManager.removeAccount(plugin, account) -    @permission(PERMS.ALL) - +    @permission(PERMS.ALL)      def login(self, username, password, remoteip=None):          """Login into pyLoad, this **must** be called when using rpc before any methods can be used. @@ -1029,9 +965,8 @@ class Api(Iface):          else:              return False -    @permission(PERMS.ALL) - +    @permission(PERMS.ALL)      def getUserData(self, username, password):          """similar to `checkAuth` but returns UserData thrift type """          user = self.checkAuth(username, password) @@ -1046,9 +981,8 @@ class Api(Iface):          return dict((user, UserData(user, data["email"], data["role"], data["permission"], data["template"])) for user, data                  in self.core.db.getAllUserData().iteritems()) -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def getServices(self):          """ A dict of available services, these can be defined by addon plugins. @@ -1056,9 +990,8 @@ class Api(Iface):          """          return dict((plugin, funcs) for plugin, funcs in self.core.addonManager.methods.iteritems()) -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def hasService(self, plugin, func):          """Checks wether a service is available. @@ -1069,9 +1002,8 @@ class Api(Iface):          cont = self.core.addonManager.methods          return plugin in cont and func in cont[plugin] -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def call(self, info):          """Calls a service (a method in addon plugin). @@ -1091,9 +1023,8 @@ class Api(Iface):          except Exception, e:              raise ServiceException(e.message) -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def getAllInfo(self):          """Returns all information stored by addon plugins. Values are always strings @@ -1101,9 +1032,8 @@ class Api(Iface):          """          return self.core.addonManager.getAllInfo() -    @permission(PERMS.STATUS) - +    @permission(PERMS.STATUS)      def getInfoByPlugin(self, plugin):          """Returns information stored by a specific plugin. diff --git a/pyload/database/Backend.py b/pyload/database/Backend.py index 48c1fcb0d..116241a13 100644 --- a/pyload/database/Backend.py +++ b/pyload/database/Backend.py @@ -21,43 +21,39 @@ DB_VERSION = 4  class style(object):      db = None -    @classmethod - +    @classmethod      def setDB(cls, db):          cls.db = db -    @classmethod - +    @classmethod      def inner(cls, f): -        @staticmethod +        @staticmethod          def x(*args, **kwargs):              if cls.db:                  return f(cls.db, *args, **kwargs)          return x -    @classmethod - +    @classmethod      def queue(cls, f): -        @staticmethod +        @staticmethod          def x(*args, **kwargs):              if cls.db:                  return cls.db.queue(f, *args, **kwargs)          return x -    @classmethod - +    @classmethod      def async(cls, f): -        @staticmethod +        @staticmethod          def x(*args, **kwargs):              if cls.db:                  return cls.db.async(f, *args, **kwargs) @@ -158,9 +154,8 @@ class DatabaseBackend(Thread):                  break              j.processJob() -    @style.queue - +    @style.queue      def shutdown(self):          self.conn.commit()          self.jobs.put("quit") @@ -282,21 +277,18 @@ class DatabaseBackend(Thread):      def createCursor(self):          return self.conn.cursor() -    @style.async - +    @style.async      def commit(self):          self.conn.commit() -    @style.queue - +    @style.queue      def syncSave(self):          self.conn.commit() -    @style.async - +    @style.async      def rollback(self):          self.conn.rollback() @@ -314,15 +306,13 @@ class DatabaseBackend(Thread):          job.wait()          return job.result -    @classmethod - +    @classmethod      def registerSub(cls, klass):          cls.subs.append(klass) -    @classmethod - +    @classmethod      def unregisterSub(cls, klass):          cls.subs.remove(klass) diff --git a/pyload/database/File.py b/pyload/database/File.py index 0ff520623..205cbba1a 100644 --- a/pyload/database/File.py +++ b/pyload/database/File.py @@ -76,9 +76,8 @@ class FileHandler(object):          self.db.syncSave() -    @lock - +    @lock      def getCompleteData(self, queue=1):          """gets a complete data representation""" @@ -97,9 +96,8 @@ class FileHandler(object):          return packs -    @lock - +    @lock      def getInfoData(self, queue=1):          """gets a data representation without links""" @@ -110,10 +108,9 @@ class FileHandler(object):          return packs +      @lock      @change - -      def addLinks(self, urls, package):          """adds links""" @@ -215,8 +212,8 @@ class FileHandler(object):                  pyfile.order -= 1                  pyfile.notifyChange() -    #-------------------------------------------------------------------------- +    #--------------------------------------------------------------------------      def releaseLink(self, id):          """removes pyfile from cache""" @@ -353,9 +350,8 @@ class FileHandler(object):          #pyfile = self.getFile(self.jobCache[occ].pop())          return pyfile -    @lock - +    @lock      def getDecryptJob(self):          """return job for decrypting"""          if "decrypt" in self.jobCache: @@ -417,10 +413,9 @@ class FileHandler(object):      def resetCount(self):          self.queuecount = -1 +      @lock      @change - -      def restartPackage(self, id):          """restart package"""          pyfiles = self.cache.values() @@ -436,10 +431,9 @@ class FileHandler(object):          e = UpdateEvent("pack", id, "collector" if not self.getPackage(id).queue else "queue")          self.core.pullManager.addEvent(e) +      @lock      @change - -      def restartFile(self, id):          """ restart file"""          if id in self.cache: @@ -453,10 +447,9 @@ class FileHandler(object):          e = UpdateEvent("file", id, "collector" if not self.getFile(id).package().queue else "queue")          self.core.pullManager.addEvent(e) +      @lock      @change - -      def setPackageLocation(self, id, queue):          """push package to queue""" @@ -488,10 +481,9 @@ class FileHandler(object):          e = InsertEvent("pack", id, p.order, "collector" if not p.queue else "queue")          self.core.pullManager.addEvent(e) +      @lock      @change - -      def reorderPackage(self, id, position):          p = self.getPackage(id) @@ -517,10 +509,9 @@ class FileHandler(object):          e = InsertEvent("pack", id, position, "collector" if not p.queue else "queue")          self.core.pullManager.addEvent(e) +      @lock      @change - -      def reorderFile(self, id, position):          f = self.getFileData(id)          f = f[id] @@ -550,9 +541,8 @@ class FileHandler(object):          e = InsertEvent("file", id, position, "collector" if not self.getPackage(f["package"]).queue else "queue")          self.core.pullManager.addEvent(e) -    @change - +    @change      def updateFileInfo(self, data, pid):          """ updates file info (name, size, status, url)"""          ids = self.db.updateLinkInfo(data) @@ -583,10 +573,9 @@ class FileHandler(object):          self.core.threadManager.createInfoThread(urls, pid) +      @lock      @change - -      def deleteFinishedLinks(self):          """ deletes finished links and packages, return deleted packages """ @@ -607,43 +596,39 @@ class FileHandler(object):          return deleted +      @lock      @change - -      def restartFailed(self):          """ restart all failed links """          self.db.restartFailed()  class FileMethods(object): -    @style.queue +    @style.queue      def filecount(self, queue):          """returns number of files in queue"""          self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=?", (queue,))          return self.c.fetchone()[0] -    @style.queue - +    @style.queue      def queuecount(self, queue):          """ number of files in queue not finished yet"""          self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? AND l.status NOT IN (0, 4)", (queue,))          return self.c.fetchone()[0] -    @style.queue - +    @style.queue      def processcount(self, queue, fid):          """ number of files which have to be proccessed """          self.c.execute("SELECT COUNT(*) FROM links as l INNER JOIN packages as p ON l.package=p.id WHERE p.queue=? AND l.status IN (2, 3, 5, 7, 12) AND l.id != ?", (queue, str(fid)))          return self.c.fetchone()[0] -    @style.inner - +    @style.inner      def _nextPackageOrder(self, queue=0):          self.c.execute('SELECT MAX(packageorder) FROM packages WHERE queue=?', (queue,))          max = self.c.fetchone()[0] @@ -652,9 +637,8 @@ class FileMethods(object):          else:              return 0 -    @style.inner - +    @style.inner      def _nextFileOrder(self, package):          self.c.execute('SELECT MAX(linkorder) FROM links WHERE package=?', (package,))          max = self.c.fetchone()[0] @@ -663,17 +647,15 @@ class FileMethods(object):          else:              return 0 -    @style.queue - +    @style.queue      def addLink(self, url, name, plugin, package):          order = self._nextFileOrder(package)          self.c.execute('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', (url, name, ".".join(plugintype, pluginname), package, order))          return self.c.lastrowid -    @style.queue - +    @style.queue      def addLinks(self, links, package):          """ links is a list of tupels (url, plugin)"""          order = self._nextFileOrder(package) @@ -681,32 +663,28 @@ class FileMethods(object):          links = [(x[0], x[0], ".".join((x[1], x[2])), package, o) for x, o in zip(links, orders)]          self.c.executemany('INSERT INTO links(url, name, plugin, package, linkorder) VALUES(?,?,?,?,?)', links) -    @style.queue - +    @style.queue      def addPackage(self, name, folder, queue):          order = self._nextPackageOrder(queue)          self.c.execute('INSERT INTO packages(name, folder, queue, packageorder) VALUES(?,?,?,?)', (name, folder, queue, order))          return self.c.lastrowid -    @style.queue - +    @style.queue      def deletePackage(self, p):          self.c.execute('DELETE FROM links WHERE package=?', (str(p.id),))          self.c.execute('DELETE FROM packages WHERE id=?', (str(p.id),))          self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=?', (p.order, p.queue)) -    @style.queue - +    @style.queue      def deleteLink(self, f):          self.c.execute('DELETE FROM links WHERE id=?', (str(f.id),))          self.c.execute('UPDATE links SET linkorder=linkorder-1 WHERE linkorder > ? AND package=?', (f.order, str(f.packageid))) -    @style.queue - +    @style.queue      def getAllLinks(self, q):          """return information about all links in queue q @@ -739,9 +717,8 @@ class FileMethods(object):          return data -    @style.queue - +    @style.queue      def getAllPackages(self, q):          """return information about packages in queue q          (only useful in get all data) @@ -778,9 +755,8 @@ class FileMethods(object):          return data -    @style.queue - +    @style.queue      def getLinkData(self, id):          """get link information as dict"""          self.c.execute('SELECT id, url, name, size, status, error, plugin, package, linkorder FROM links WHERE id=?', (str(id),)) @@ -804,9 +780,8 @@ class FileMethods(object):          return data -    @style.queue - +    @style.queue      def getPackageData(self, id):          """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),)) @@ -829,21 +804,18 @@ class FileMethods(object):          return data -    @style.async - +    @style.async      def updateLink(self, f):          self.c.execute('UPDATE links SET url=?, name=?, size=?, status=?, error=?, package=? WHERE id=?', (f.url, f.name, f.size, f.status, str(f.error), str(f.packageid), str(f.id))) -    @style.queue - +    @style.queue      def updatePackage(self, p):          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 - +    @style.queue      def updateLinkInfo(self, data):          """ data is list of tupels (name, size, status, url) """          self.c.executemany('UPDATE links SET name=?, size=?, status=? WHERE url=? AND status IN (1, 2, 3, 14)', data) @@ -853,9 +825,8 @@ class FileMethods(object):              ids.append(int(r[0]))          return ids -    @style.queue - +    @style.queue      def reorderPackage(self, p, position, noMove=False):          if position == -1:              position = self._nextPackageOrder(p.queue) @@ -867,9 +838,8 @@ class FileMethods(object):          self.c.execute('UPDATE packages SET packageorder=? WHERE id=?', (position, str(p.id))) -    @style.queue - +    @style.queue      def reorderLink(self, f, position):          """ reorder link with f as dict for pyfile  """          if f["order"] > position: @@ -879,28 +849,24 @@ class FileMethods(object):          self.c.execute('UPDATE links SET linkorder=? WHERE id=?', (position, f["id"])) -    @style.queue - +    @style.queue      def clearPackageOrder(self, p):          self.c.execute('UPDATE packages SET packageorder=? WHERE id=?', (-1, str(p.id)))          self.c.execute('UPDATE packages SET packageorder=packageorder-1 WHERE packageorder > ? AND queue=? AND id != ?', (p.order, p.queue, str(p.id))) -    @style.async - +    @style.async      def restartFile(self, id):          self.c.execute('UPDATE links SET status=3, error="" WHERE id=?', (str(id),)) -    @style.async - +    @style.async      def restartPackage(self, id):          self.c.execute('UPDATE links SET status=3 WHERE package=?', (str(id),)) -    @style.queue - +    @style.queue      def getPackage(self, id):          """return package instance from id"""          self.c.execute("SELECT name, folder, site, password, queue, packageorder FROM packages WHERE id=?", (str(id),)) @@ -921,9 +887,8 @@ class FileMethods(object):          r[5] = tuple(r[5].split('.'))          return PyFile(self.manager, id, * r) -    @style.queue - +    @style.queue      def getJob(self, occ):          """return pyfile ids, which are suitable for download and dont use a occupied plugin""" @@ -943,9 +908,8 @@ class FileMethods(object):          return [x[0] for x in self.c] -    @style.queue - +    @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, 14) ORDER BY p.packageorder ASC, l.linkorder ASC LIMIT 5" % plugins @@ -954,39 +918,34 @@ class FileMethods(object):          return [x[0] for x in self.c] -    @style.queue - +    @style.queue      def getUnfinished(self, pid):          """return list of max length 3 ids with pyfiles in package not finished or processed"""          self.c.execute("SELECT id FROM links WHERE package=? AND status NOT IN (0, 4, 13) LIMIT 3", (str(pid),))          return [r[0] for r in self.c] -    @style.queue - +    @style.queue      def deleteFinished(self):          self.c.execute("DELETE FROM links WHERE status IN (0, 4)")          self.c.execute("DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE packages.id=links.package)") -    @style.queue - +    @style.queue      def restartFailed(self):          self.c.execute("UPDATE links SET status=3, error='' WHERE status IN (6, 8, 9)") -    @style.queue - +    @style.queue      def findDuplicates(self, id, folder, filename):          """ checks if filename exists with different id and same package """          self.c.execute("SELECT l.plugin FROM links as l INNER JOIN packages as p ON l.package=p.id AND p.folder=? WHERE l.id!=? AND l.status=0 AND l.name=?", (folder, id, filename))          return self.c.fetchone() -    @style.queue - +    @style.queue      def purgeLinks(self):          self.c.execute("DELETE FROM links;")          self.c.execute("DELETE FROM packages;") diff --git a/pyload/database/Storage.py b/pyload/database/Storage.py index bd7844d8d..a1dfb7e9f 100644 --- a/pyload/database/Storage.py +++ b/pyload/database/Storage.py @@ -5,9 +5,9 @@ from pyload.database import style  from pyload.database import DatabaseBackend  class StorageMethods(object): -    @style.queue +    @style.queue      def setStorage(db, identifier, key, value):          db.c.execute("SELECT id FROM storage WHERE identifier=? AND key=?", (identifier, key))          if db.c.fetchone() is not None: @@ -15,9 +15,8 @@ class StorageMethods(object):          else:              db.c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", (identifier, key, value)) -    @style.queue - +    @style.queue      def getStorage(db, identifier, key=None):          if key is not None:              db.c.execute("SELECT value FROM storage WHERE identifier=? AND key=?", (identifier, key)) @@ -31,9 +30,8 @@ class StorageMethods(object):                  d[row[0]] = row[1]              return d -    @style.queue - +    @style.queue      def delStorage(db, identifier, key):          db.c.execute("DELETE FROM storage WHERE identifier=? AND key=?", (identifier, key)) diff --git a/pyload/database/User.py b/pyload/database/User.py index 52b05749f..94f70d499 100644 --- a/pyload/database/User.py +++ b/pyload/database/User.py @@ -7,9 +7,9 @@ import random  from pyload.database import DatabaseBackend, style  class UserMethods(object): -    @style.queue +    @style.queue      def checkAuth(db, user, password):          c = db.c          c.execute('SELECT id, name, password, role, permission, template, email FROM "users" WHERE name=?', (user,)) @@ -26,9 +26,8 @@ class UserMethods(object):          else:              return {} -    @style.queue - +    @style.queue      def addUser(db, user, password):          salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for i in range(0, 5)])          h = sha1(salt + password) @@ -43,8 +42,6 @@ class UserMethods(object):      @style.queue - -      def changePassword(db, user, oldpw, newpw):          db.c.execute('SELECT id, name, password FROM users WHERE name=?', (user,))          r = db.c.fetchone() @@ -66,21 +63,16 @@ class UserMethods(object):      @style.async - -      def setPermission(db, user, perms):          db.c.execute("UPDATE users SET permission=? WHERE name=?", (perms, user)) -    @style.async - +    @style.async      def setRole(db, user, role):          db.c.execute("UPDATE users SET role=? WHERE name=?", (role, user))      @style.queue - -      def listUsers(db):          db.c.execute('SELECT name FROM users')          users = [] @@ -88,9 +80,8 @@ class UserMethods(object):              users.append(row[0])          return users -    @style.queue - +    @style.queue      def getAllUserData(db):          db.c.execute("SELECT name, permission, role, template, email FROM users")          user = {} @@ -99,9 +90,8 @@ class UserMethods(object):          return user -    @style.queue - +    @style.queue      def removeUser(db, user):          db.c.execute('DELETE FROM users WHERE name=?', (user,)) diff --git a/pyload/datatype/File.py b/pyload/datatype/File.py index 9a29a1f41..713442265 100644 --- a/pyload/datatype/File.py +++ b/pyload/datatype/File.py @@ -81,9 +81,8 @@ class PyFile(object):      def __repr__(self):          return "PyFile %s: %s@%s" % (self.id, self.name, self.pluginname) -    @lock - +    @lock      def initPlugin(self):          """ inits plugin instance """          if not self.plugin: @@ -91,9 +90,8 @@ class PyFile(object):              self.pluginclass  = getattr(self.pluginmodule, self.m.core.pluginManager.getPluginName(self.plugintype, self.pluginname))              self.plugin       = self.pluginclass(self) -    @lock - +    @lock      def hasPlugin(self):          """Thread safe way to determine this file has initialized plugin attribute @@ -132,9 +130,8 @@ class PyFile(object):          """sync PyFile instance with database"""          self.m.updateLink(self) -    @lock - +    @lock      def release(self):          """sync and remove from cache"""          # file has valid package diff --git a/pyload/datatype/Package.py b/pyload/datatype/Package.py index cad6519db..7a36a1323 100644 --- a/pyload/datatype/Package.py +++ b/pyload/datatype/Package.py @@ -22,9 +22,8 @@ class PyPackage(object):          self.order = order          self.setFinished = False -    @property - +    @property      def folder(self):          return safe_filename(self._folder) diff --git a/pyload/manager/Account.py b/pyload/manager/Account.py index 9b7cb590a..ea6f15e87 100644 --- a/pyload/manager/Account.py +++ b/pyload/manager/Account.py @@ -144,8 +144,6 @@ class AccountManager(object):      @lock - -      def updateAccount(self, plugin , user, password=None, options={}):          """add or update account"""          if plugin in self.accounts: @@ -158,8 +156,6 @@ class AccountManager(object):      @lock - -      def removeAccount(self, plugin, user):          """remove account""" @@ -171,8 +167,6 @@ class AccountManager(object):      @lock - -      def getAccountInfos(self, force=True, refresh=False):          data = {} diff --git a/pyload/manager/Addon.py b/pyload/manager/Addon.py index 61585e1cb..cf23715b6 100644 --- a/pyload/manager/Addon.py +++ b/pyload/manager/Addon.py @@ -179,8 +179,6 @@ class AddonManager(object):      @try_catch - -      def coreReady(self):          for plugin in self.plugins:              if plugin.isActivated(): @@ -190,8 +188,6 @@ class AddonManager(object):      @try_catch - -      def coreExiting(self):          for plugin in self.plugins:              if plugin.isActivated(): @@ -201,8 +197,6 @@ class AddonManager(object):      @lock - -      def downloadPreparing(self, pyfile):          for plugin in self.plugins:              if plugin.isActivated(): @@ -212,8 +206,6 @@ class AddonManager(object):      @lock - -      def downloadFinished(self, pyfile):          for plugin in self.plugins:              if plugin.isActivated(): @@ -224,8 +216,6 @@ class AddonManager(object):      @lock      @try_catch - -      def downloadFailed(self, pyfile):          for plugin in self.plugins:              if plugin.isActivated(): @@ -235,8 +225,6 @@ class AddonManager(object):      @lock - -      def packageFinished(self, package):          for plugin in self.plugins:              if plugin.isActivated(): @@ -246,8 +234,6 @@ class AddonManager(object):      @lock - -      def beforeReconnecting(self, ip):          for plugin in self.plugins:              plugin.beforeReconnecting(ip) @@ -256,8 +242,6 @@ class AddonManager(object):      @lock - -      def afterReconnecting(self, ip):          for plugin in self.plugins:              if plugin.isActivated(): diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index dd8e6bcce..147dff31f 100644 --- a/pyload/manager/Thread.py +++ b/pyload/manager/Thread.py @@ -71,9 +71,8 @@ class ThreadManager(object):          InfoThread(self, data, pid) -    @lock - +    @lock      def createResultThread(self, data, add=False):          """ creates a thread to fetch online status, returns result id """          self.timestamp = time() + 5 * 60 @@ -85,9 +84,8 @@ class ThreadManager(object):          return rid -    @lock - +    @lock      def getInfoResult(self, rid):          """returns result and clears it"""          self.timestamp = time() + 5 * 60 @@ -99,9 +97,8 @@ class ThreadManager(object):          else:              return {} -    @lock - +    @lock      def setInfoResults(self, rid, result):          self.infoResults[rid].update(result) diff --git a/pyload/network/Browser.py b/pyload/network/Browser.py index 1c0596ccc..61bf523ab 100644 --- a/pyload/network/Browser.py +++ b/pyload/network/Browser.py @@ -42,17 +42,15 @@ class Browser(object):          self.cj = cj          self.http.cj = cj -    @property - +    @property      def speed(self):          if self.dl:              return self.dl.speed          return 0 -    @property - +    @property      def size(self):          if self._size:              return self._size @@ -60,17 +58,15 @@ class Browser(object):              return self.dl.size          return 0 -    @property - +    @property      def arrived(self):          if self.dl:              return self.dl.arrived          return 0 -    @property - +    @property      def percent(self):          if not self.size: return 0          return (self.arrived * 100) / self.size diff --git a/pyload/network/HTTPChunk.py b/pyload/network/HTTPChunk.py index 5395b7bda..c11ad9e3c 100644 --- a/pyload/network/HTTPChunk.py +++ b/pyload/network/HTTPChunk.py @@ -67,9 +67,8 @@ class ChunkInfo(object):              fh.write("\trange:%i-%i\n" % c[1])          fh.close() -    @staticmethod - +    @staticmethod      def load(name):          fs_name = fs_encode("%s.chunks" % name)          if not exists(fs_name): @@ -153,9 +152,8 @@ class HTTPChunk(HTTPRequest):      def __repr__(self):          return "<HTTPChunk id=%d, size=%d, arrived=%d>" % (self.id, self.size, self.arrived) -    @property - +    @property      def cj(self):          return self.p.cj diff --git a/pyload/network/HTTPDownload.py b/pyload/network/HTTPDownload.py index 89e594640..0580a6b90 100644 --- a/pyload/network/HTTPDownload.py +++ b/pyload/network/HTTPDownload.py @@ -58,22 +58,19 @@ class HTTPDownload(object):          self.progress = progress -    @property - +    @property      def speed(self):          last = [sum(x) for x in self.lastSpeeds if x]          return (sum(self.speeds) + sum(last)) / (1 + len(last)) -    @property - +    @property      def arrived(self):          return sum([c.arrived for c in self.chunks]) -    @property - +    @property      def percent(self):          if not self.size: return 0          return (self.arrived * 100) / self.size diff --git a/pyload/network/JsEngine.py b/pyload/network/JsEngine.py index bcf6ae0e2..c64e8c490 100644 --- a/pyload/network/JsEngine.py +++ b/pyload/network/JsEngine.py @@ -33,8 +33,6 @@ class JsEngine(object):      @classmethod - -      def find(cls):          """ Check if there is any engine available """          return [E for E in ENGINES if E.find()] @@ -122,8 +120,6 @@ class AbstractEngine(object):      @classmethod - -      def find(cls):          """ Check if the engine is available """          try: diff --git a/pyload/network/XDCCRequest.py b/pyload/network/XDCCRequest.py index a4813e039..01fc2ea78 100644 --- a/pyload/network/XDCCRequest.py +++ b/pyload/network/XDCCRequest.py @@ -132,21 +132,18 @@ class XDCCRequest(object):      def abortDownloads(self):          self.abort = True -    @property - +    @property      def size(self):          return self.filesize -    @property - +    @property      def arrived(self):          return self.recv -    @property - +    @property      def percent(self):          if not self.filesize: return 0          return (self.recv * 100) / self.filesize diff --git a/pyload/plugin/Account.py b/pyload/plugin/Account.py index 09dd90ad0..6a3eddc5b 100644 --- a/pyload/plugin/Account.py +++ b/pyload/plugin/Account.py @@ -63,8 +63,6 @@ class Account(Base):      @lock - -      def _login(self, user, data):          # set timestamp for login          self.timestamps[user] = time() @@ -139,8 +137,6 @@ class Account(Base):      @lock - -      def getAccountInfo(self, name, force=False):          """retrieve account infos for an user, do **not** overwrite this method!\\          just use it to retrieve infos in hoster plugins. see `loadAccountInfo` @@ -299,8 +295,6 @@ class Account(Base):      @lock - -      def checkLogin(self, user):          """ checks if user is still logged in """          if user in self.timestamps: diff --git a/pyload/plugin/Extractor.py b/pyload/plugin/Extractor.py index decb332fd..c0948c3dd 100644 --- a/pyload/plugin/Extractor.py +++ b/pyload/plugin/Extractor.py @@ -36,23 +36,17 @@ class Extractor:      @classmethod - -      def isArchive(cls, filename):          name = os.path.basename(filename).lower()          return any(name.endswith(ext) for ext in cls.EXTENSIONS)      @classmethod - -      def isMultipart(cls, filename):          return False      @classmethod - -      def isUsable(cls):          """ Check if system statisfy dependencies          :return: boolean @@ -61,8 +55,6 @@ class Extractor:      @classmethod - -      def getTargets(cls, files_ids):          """ Filter suited targets from list of filename id tuple list          :param files_ids: List of filepathes diff --git a/pyload/plugin/addon/AndroidPhoneNotify.py b/pyload/plugin/addon/AndroidPhoneNotify.py index 3fb291e11..8332f668d 100644 --- a/pyload/plugin/addon/AndroidPhoneNotify.py +++ b/pyload/plugin/addon/AndroidPhoneNotify.py @@ -75,8 +75,6 @@ class AndroidPhoneNotify(Addon):      @Expose - -      def notify(self,                 event,                 msg="", diff --git a/pyload/plugin/addon/AntiVirus.py b/pyload/plugin/addon/AntiVirus.py index c6628a684..3866014ee 100644 --- a/pyload/plugin/addon/AntiVirus.py +++ b/pyload/plugin/addon/AntiVirus.py @@ -43,8 +43,6 @@ class AntiVirus(Addon):      @Expose      @threaded - -      def scan(self, pyfile, thread):          file     = fs_encode(pyfile.plugin.lastDownload)          filename = os.path.basename(pyfile.plugin.lastDownload) diff --git a/pyload/plugin/addon/ClickNLoad.py b/pyload/plugin/addon/ClickNLoad.py index 6a3d5d662..b6448598a 100644 --- a/pyload/plugin/addon/ClickNLoad.py +++ b/pyload/plugin/addon/ClickNLoad.py @@ -48,8 +48,6 @@ class ClickNLoad(Addon):      @threaded - -      def proxy(self, ip, webport, cnlport):          time.sleep(10)  #@TODO: Remove in 0.4.10 (implement addon delay on startup) @@ -63,8 +61,6 @@ class ClickNLoad(Addon):      @threaded - -      def _server(self, ip, webport, cnlport):          try:              dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) diff --git a/pyload/plugin/addon/DeleteFinished.py b/pyload/plugin/addon/DeleteFinished.py index c0a2e8752..b9368a642 100644 --- a/pyload/plugin/addon/DeleteFinished.py +++ b/pyload/plugin/addon/DeleteFinished.py @@ -60,9 +60,9 @@ class DeleteFinished(Addon):      ## own methods ## -    @style.queue +    @style.queue      def deleteFinished(self, mode):          self.c.execute('DELETE FROM packages WHERE NOT EXISTS(SELECT 1 FROM links WHERE package=packages.id AND status NOT IN (%s))' % mode)          self.c.execute('DELETE FROM links WHERE NOT EXISTS(SELECT 1 FROM packages WHERE id=links.package)') diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index a52b55f0a..b2eeec1a3 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -193,8 +193,6 @@ class ExtractArchive(Addon):      @threaded - -      def extractQueued(self, thread):          packages = self.queue.get()          while packages: @@ -211,8 +209,6 @@ class ExtractArchive(Addon):      @Expose - -      def extractPackage(self, *ids):          """ Extract packages with given id"""          for id in ids: @@ -238,8 +234,6 @@ class ExtractArchive(Addon):      @Expose - -      def extract(self, ids, thread=None):  #@TODO: Use pypack, not pid to improve method usability          if not ids:              return False @@ -512,8 +506,6 @@ class ExtractArchive(Addon):      @Expose - -      def getPasswords(self, reload=True):          """ List of saved passwords """          if reload: @@ -539,8 +531,6 @@ class ExtractArchive(Addon):      @Expose - -      def addPassword(self, password):          """  Adds a password to saved list"""          try: diff --git a/pyload/plugin/addon/MergeFiles.py b/pyload/plugin/addon/MergeFiles.py index e7da4a82a..dfc5f41d4 100644 --- a/pyload/plugin/addon/MergeFiles.py +++ b/pyload/plugin/addon/MergeFiles.py @@ -26,8 +26,6 @@ class MergeFiles(Addon):      @threaded - -      def packageFinished(self, pack):          files = {}          fid_dict = {} diff --git a/pyload/plugin/addon/SkipRev.py b/pyload/plugin/addon/SkipRev.py index e55d98056..5209da615 100644 --- a/pyload/plugin/addon/SkipRev.py +++ b/pyload/plugin/addon/SkipRev.py @@ -25,8 +25,6 @@ class SkipRev(Addon):      @staticmethod - -      def _setup(self):          self.pyfile.plugin._setup()          if self.pyfile.hasStatus("skipped"): diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py index c7c7ec047..c7fb27a3d 100644 --- a/pyload/plugin/addon/UpdateManager.py +++ b/pyload/plugin/addon/UpdateManager.py @@ -82,9 +82,8 @@ class UpdateManager(Addon):             and time.time() - max(self.MIN_CHECK_INTERVAL, self.getConfig('checkinterval') * 60 * 60) > self.info['last_check']:              self.update() -    @Expose - +    @Expose      def autoreloadPlugins(self):          """ reload and reindex all modified plugins """          modules = filter( @@ -121,10 +120,9 @@ class UpdateManager(Addon):          except Exception:              self.logWarning(_("Unable to retrieve server to get updates")) +      @Expose      @threaded - -      def update(self):          """ check for updates """ @@ -275,9 +273,8 @@ class UpdateManager(Addon):          # 2 = Plugins updated, but restart required          return exitcode -    @Expose - +    @Expose      def removePlugins(self, type_plugins):          """ delete plugins from disk """ diff --git a/pyload/plugin/addon/WindowsPhoneNotify.py b/pyload/plugin/addon/WindowsPhoneNotify.py index f7a5e6ec1..b1d1c8b0f 100644 --- a/pyload/plugin/addon/WindowsPhoneNotify.py +++ b/pyload/plugin/addon/WindowsPhoneNotify.py @@ -82,8 +82,6 @@ class WindowsPhoneNotify(Addon):      @Expose - -      def notify(self,                 event,                 msg="", diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py index 7cf6aee35..b6d86adab 100644 --- a/pyload/plugin/extractor/SevenZip.py +++ b/pyload/plugin/extractor/SevenZip.py @@ -38,8 +38,6 @@ class SevenZip(UnRar):      @classmethod - -      def isUsable(cls):          if os.name == "nt":              cls.CMD = os.path.join(pypath, "7z.exe") diff --git a/pyload/plugin/extractor/UnRar.py b/pyload/plugin/extractor/UnRar.py index 32d33bc51..cad58ff4f 100644 --- a/pyload/plugin/extractor/UnRar.py +++ b/pyload/plugin/extractor/UnRar.py @@ -49,8 +49,6 @@ class UnRar(Extractor):      @classmethod - -      def isUsable(cls):          if os.name == "nt":              try: @@ -82,8 +80,6 @@ class UnRar(Extractor):      @classmethod - -      def isMultipart(cls, filename):          return True if cls.re_multipart.search(filename) else False diff --git a/pyload/plugin/extractor/UnZip.py b/pyload/plugin/extractor/UnZip.py index 5e93064c2..b4fa637f0 100644 --- a/pyload/plugin/extractor/UnZip.py +++ b/pyload/plugin/extractor/UnZip.py @@ -25,8 +25,6 @@ class UnZip(Extractor):      @classmethod - -      def isUsable(cls):          return sys.version_info[:2] >= (2, 6) diff --git a/pyload/plugin/hook/BypassCaptcha.py b/pyload/plugin/hook/BypassCaptcha.py index 01359f3d3..141ac7282 100644 --- a/pyload/plugin/hook/BypassCaptcha.py +++ b/pyload/plugin/hook/BypassCaptcha.py @@ -123,8 +123,6 @@ class BypassCaptcha(Hook):      @threaded - -      def _processCaptcha(self, task):          c = task.captchaFile          try: diff --git a/pyload/plugin/hook/Captcha9Kw.py b/pyload/plugin/hook/Captcha9Kw.py index b388de444..9cb8e7928 100644 --- a/pyload/plugin/hook/Captcha9Kw.py +++ b/pyload/plugin/hook/Captcha9Kw.py @@ -61,8 +61,6 @@ class Captcha9kw(Hook):      @threaded - -      def _processCaptcha(self, task):          try:              with open(task.captchaFile, 'rb') as f: diff --git a/pyload/plugin/hook/CaptchaBrotherhood.py b/pyload/plugin/hook/CaptchaBrotherhood.py index a4a461517..eff005d14 100644 --- a/pyload/plugin/hook/CaptchaBrotherhood.py +++ b/pyload/plugin/hook/CaptchaBrotherhood.py @@ -160,8 +160,6 @@ class CaptchaBrotherhood(Hook):      @threaded - -      def _processCaptcha(self, task):          c = task.captchaFile          try: diff --git a/pyload/plugin/hook/DeathByCaptcha.py b/pyload/plugin/hook/DeathByCaptcha.py index 3688a68d0..4b77c8718 100644 --- a/pyload/plugin/hook/DeathByCaptcha.py +++ b/pyload/plugin/hook/DeathByCaptcha.py @@ -206,8 +206,6 @@ class DeathByCaptcha(Hook):      @threaded - -      def _processCaptcha(self, task):          c = task.captchaFile          try: diff --git a/pyload/plugin/hook/ExpertDecoders.py b/pyload/plugin/hook/ExpertDecoders.py index b34309d25..2e2982d2d 100644 --- a/pyload/plugin/hook/ExpertDecoders.py +++ b/pyload/plugin/hook/ExpertDecoders.py @@ -46,8 +46,6 @@ class ExpertDecoders(Hook):      @threaded - -      def _processCaptcha(self, task):          task.data['ticket'] = ticket = uuid4()          result = None diff --git a/pyload/plugin/hook/ImageTyperz.py b/pyload/plugin/hook/ImageTyperz.py index 717077790..ca5e02559 100644 --- a/pyload/plugin/hook/ImageTyperz.py +++ b/pyload/plugin/hook/ImageTyperz.py @@ -141,8 +141,6 @@ class ImageTyperz(Hook):      @threaded - -      def _processCaptcha(self, task):          c = task.captchaFile          try: diff --git a/pyload/plugin/hoster/LinksnappyCom.py b/pyload/plugin/hoster/LinksnappyCom.py index 3f2cf9821..2cb14dd51 100644 --- a/pyload/plugin/hoster/LinksnappyCom.py +++ b/pyload/plugin/hoster/LinksnappyCom.py @@ -51,8 +51,6 @@ class LinksnappyCom(MultiHoster):      @staticmethod - -      def _get_host(url):          host = urlsplit(url).netloc          return re.search(r'[\w-]+\.\w+$', host).group(0) diff --git a/pyload/plugin/hoster/ShareonlineBiz.py b/pyload/plugin/hoster/ShareonlineBiz.py index 608ee73b3..dcdeca168 100644 --- a/pyload/plugin/hoster/ShareonlineBiz.py +++ b/pyload/plugin/hoster/ShareonlineBiz.py @@ -37,8 +37,6 @@ class ShareonlineBiz(SimpleHoster):      @classmethod - -      def getInfo(cls, url="", html=""):          info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': url} diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py index 7660ec3ad..7031d0ab2 100644 --- a/pyload/plugin/hoster/UploadedTo.py +++ b/pyload/plugin/hoster/UploadedTo.py @@ -32,8 +32,6 @@ class UploadedTo(SimpleHoster):      @classmethod - -      def apiInfo(cls, url="", get={}, post={}):          info = super(UploadedTo, cls).apiInfo(url) diff --git a/pyload/plugin/hoster/WebshareCz.py b/pyload/plugin/hoster/WebshareCz.py index 673dfaac5..11b7b37b0 100644 --- a/pyload/plugin/hoster/WebshareCz.py +++ b/pyload/plugin/hoster/WebshareCz.py @@ -21,8 +21,6 @@ class WebshareCz(SimpleHoster):      @classmethod - -      def getInfo(cls, url="", html=""):          info = super(WebshareCz, cls).getInfo(url, html) diff --git a/pyload/plugin/hoster/ZDF.py b/pyload/plugin/hoster/ZDF.py index 6f17df61a..c02eadc23 100644 --- a/pyload/plugin/hoster/ZDF.py +++ b/pyload/plugin/hoster/ZDF.py @@ -23,8 +23,6 @@ class ZDF(Hoster):      @staticmethod - -      def video_key(video):          return (              int(video.findtext("videoBitrate", "0")), @@ -33,16 +31,12 @@ class ZDF(Hoster):      @staticmethod - -      def video_valid(video):          return video.findtext("url").startswith("http") and video.findtext("url").endswith(".mp4") and \                 video.findtext("facets/facet").startswith("progressive")      @staticmethod - -      def get_id(url):          return int(re.search(r"\D*(\d{4,})\D*", url).group(1)) diff --git a/pyload/plugin/internal/BasePlugin.py b/pyload/plugin/internal/BasePlugin.py index 1ddfee122..996dc8e76 100644 --- a/pyload/plugin/internal/BasePlugin.py +++ b/pyload/plugin/internal/BasePlugin.py @@ -24,8 +24,6 @@ class BasePlugin(Hoster):      @classmethod - -      def getInfo(cls, url="", html=""):  #@TODO: Move to hoster class in 0.4.10          url   = unquote(url)          url_p = urlparse(url) diff --git a/pyload/plugin/internal/DeadCrypter.py b/pyload/plugin/internal/DeadCrypter.py index c66a1b5e3..daa7e1a0d 100644 --- a/pyload/plugin/internal/DeadCrypter.py +++ b/pyload/plugin/internal/DeadCrypter.py @@ -16,8 +16,6 @@ class DeadCrypter(_Crypter):      @classmethod - -      def apiInfo(cls, url="", get={}, post={}):          api = super(DeadCrypter, self).apiInfo(url, get, post)          api['status'] = 1 diff --git a/pyload/plugin/internal/DeadHoster.py b/pyload/plugin/internal/DeadHoster.py index 5f00d0128..2e57decdb 100644 --- a/pyload/plugin/internal/DeadHoster.py +++ b/pyload/plugin/internal/DeadHoster.py @@ -16,8 +16,6 @@ class DeadHoster(_Hoster):      @classmethod - -      def apiInfo(cls, url="", get={}, post={}):          api = super(DeadHoster, self).apiInfo(url, get, post)          api['status'] = 1 diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py index b32cb60c0..9fe5b1260 100644 --- a/pyload/plugin/internal/SimpleHoster.py +++ b/pyload/plugin/internal/SimpleHoster.py @@ -311,16 +311,13 @@ class SimpleHoster(Hoster):      @classmethod - -      def parseInfos(cls, urls):  #@TODO: Built-in in 0.4.10 core (remove from plugins)          for url in urls:              url = replace_patterns(url, cls.URL_REPLACEMENTS)              yield cls.getInfo(url) -    @classmethod - +    @classmethod      def apiInfo(cls, url="", get={}, post={}):          url   = urllib.unquote(url)          url_p = urlparse.urlparse(url) @@ -331,9 +328,8 @@ class SimpleHoster(Hoster):                  'status': 3 if url else 8,                  'url': url} -    @classmethod - +    @classmethod      def getInfo(cls, url="", html=""):          info   = cls.apiInfo(url)          online = False if info['status'] != 2 else True | 
