summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-11-21 11:21:41 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-11-21 11:21:41 +0100
commit81e7cf57cb2300474abc634e706e77dfc9f5dbcf (patch)
treefa8db4c01268327fa1a70123c287b7b33b3353fc /module
parentautomatic plugin reloader (diff)
downloadpyload-81e7cf57cb2300474abc634e706e77dfc9f5dbcf.tar.xz
SimpleHoster fix
Diffstat (limited to 'module')
-rw-r--r--module/plugins/internal/SimpleHoster.py14
-rw-r--r--module/remote/socketbackend/create_ttypes.py6
-rw-r--r--module/remote/socketbackend/ttypes.py148
3 files changed, 85 insertions, 83 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index e0963fd91..2fbb07b2e 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -16,12 +16,12 @@
@author: zoidberg
"""
+from urlparse import urlparse
+from re import search
from module.plugins.Hoster import Hoster
from module.utils import html_unescape
from module.network.RequestFactory import getURL
-from re import search
-
def parseFileInfo(self, url = '', html = ''):
if not html and hasattr(self, "html"): html = self.html
@@ -66,6 +66,7 @@ def create_getInfo(plugin):
class PluginParseError(Exception):
def __init__(self, msg):
+ Exception.__init__(msg)
self.value = 'Parse error (%s) - plugin may be out of date' % msg
def __str__(self):
return repr(self.value)
@@ -78,10 +79,11 @@ class SimpleHoster(Hoster):
__description__ = """Base hoster plugin"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
+
+ #TODO: could be replaced when using utils.parseFileSize ?
SIZE_UNITS = {'kB': 1, 'KB': 1, 'KiB': 1, 'MB': 2, 'MiB': 2, 'GB': 3, 'GiB': 3}
SIZE_REPLACEMENTS = {',': '', ' ': ''}
-
+
def setup(self):
self.resumeDownload = self.multiDL = True if self.account else False
@@ -92,7 +94,7 @@ class SimpleHoster(Hoster):
self.handlePremium()
else:
self.handleFree()
-
+
def getFileInfo(self):
self.logDebug("URL: %s" % self.pyfile.url)
name, size, status, url = parseFileInfo(self)
@@ -102,7 +104,7 @@ class SimpleHoster(Hoster):
self.parseError('File info')
if not name:
- name = html_unescape(urlparse(pyfile.url).path.split("/")[-1])
+ name = html_unescape(urlparse(self.pyfile.url).path.split("/")[-1])
self.logDebug("FILE NAME: %s FILE SIZE: %s" % (name, size))
self.pyfile.name, self.pyfile.size = name, size
diff --git a/module/remote/socketbackend/create_ttypes.py b/module/remote/socketbackend/create_ttypes.py
index db27bd02f..0d6192a5a 100644
--- a/module/remote/socketbackend/create_ttypes.py
+++ b/module/remote/socketbackend/create_ttypes.py
@@ -42,7 +42,7 @@ def main():
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
class BaseObject(object):
- __slots__ = []
+\t__slots__ = []
""")
@@ -60,7 +60,7 @@ class BaseObject(object):
for klass in classes:
name = klass.__name__
- base = "BaseException" if issubclass(klass, ttypes.TExceptionBase) else "BaseObject"
+ base = "Exception" if issubclass(klass, ttypes.TExceptionBase) else "BaseObject"
f.write("class %s(%s):\n" % (name, base))
f.write("\t__slots__ = %s\n\n" % klass.__slots__)
@@ -77,7 +77,7 @@ class BaseObject(object):
for name in dir(Iface):
if name.startswith("_"): continue
- f.write("\tdef %s():\n\t\tpass\n" % name)
+ f.write("\tdef %s(self):\n\t\tpass\n" % name)
f.write("\n")
diff --git a/module/remote/socketbackend/ttypes.py b/module/remote/socketbackend/ttypes.py
index 30a7d3adc..527dff767 100644
--- a/module/remote/socketbackend/ttypes.py
+++ b/module/remote/socketbackend/ttypes.py
@@ -117,7 +117,7 @@ class FileData(BaseObject):
self.error = error
self.order = order
-class FileDoesNotExists(BaseException):
+class FileDoesNotExists(Exception):
__slots__ = ['fid']
def init(self, fid=None):
@@ -158,7 +158,7 @@ class PackageData(BaseObject):
self.links = links
self.fids = fids
-class PackageDoesNotExists(BaseException):
+class PackageDoesNotExists(Exception):
__slots__ = ['pid']
def init(self, pid=None):
@@ -185,14 +185,14 @@ class ServiceCall(BaseObject):
self.arguments = arguments
self.parseArguments = parseArguments
-class ServiceDoesNotExists(BaseException):
+class ServiceDoesNotExists(Exception):
__slots__ = ['plugin', 'func']
def init(self, plugin=None, func=None):
self.plugin = plugin
self.func = func
-class ServiceException(BaseException):
+class ServiceException(Exception):
__slots__ = ['msg']
def init(self, msg=None):
@@ -209,144 +209,144 @@ class UserData(BaseObject):
self.templateName = templateName
class Iface:
- def addFiles():
+ def addFiles(self):
pass
- def addPackage():
+ def addPackage(self):
pass
- def call():
+ def call(self):
pass
- def checkOnlineStatus():
+ def checkOnlineStatus(self):
pass
- def checkOnlineStatusContainer():
+ def checkOnlineStatusContainer(self):
pass
- def checkURLs():
+ def checkURLs(self):
pass
- def deleteFiles():
+ def deleteFiles(self):
pass
- def deleteFinished():
+ def deleteFinished(self):
pass
- def deletePackages():
+ def deletePackages(self):
pass
- def freeSpace():
+ def freeSpace(self):
pass
- def generateAndAddPackages():
+ def generateAndAddPackages(self):
pass
- def generatePackages():
+ def generatePackages(self):
pass
- def getAccountTypes():
+ def getAccountTypes(self):
pass
- def getAccounts():
+ def getAccounts(self):
pass
- def getAllInfo():
+ def getAllInfo(self):
pass
- def getAllUserData():
+ def getAllUserData(self):
pass
- def getCaptchaTask():
+ def getCaptchaTask(self):
pass
- def getCaptchaTaskStatus():
+ def getCaptchaTaskStatus(self):
pass
- def getCollector():
+ def getCollector(self):
pass
- def getCollectorData():
+ def getCollectorData(self):
pass
- def getConfig():
+ def getConfig(self):
pass
- def getConfigValue():
+ def getConfigValue(self):
pass
- def getEvents():
+ def getEvents(self):
pass
- def getFileData():
+ def getFileData(self):
pass
- def getFileOrder():
+ def getFileOrder(self):
pass
- def getInfoByPlugin():
+ def getInfoByPlugin(self):
pass
- def getLog():
+ def getLog(self):
pass
- def getPackageData():
+ def getPackageData(self):
pass
- def getPackageInfo():
+ def getPackageInfo(self):
pass
- def getPackageOrder():
+ def getPackageOrder(self):
pass
- def getPluginConfig():
+ def getPluginConfig(self):
pass
- def getQueue():
+ def getQueue(self):
pass
- def getQueueData():
+ def getQueueData(self):
pass
- def getServerVersion():
+ def getServerVersion(self):
pass
- def getServices():
+ def getServices(self):
pass
- def getUserData():
+ def getUserData(self):
pass
- def hasService():
+ def hasService(self):
pass
- def isCaptchaWaiting():
+ def isCaptchaWaiting(self):
pass
- def isTimeDownload():
+ def isTimeDownload(self):
pass
- def isTimeReconnect():
+ def isTimeReconnect(self):
pass
- def kill():
+ def kill(self):
pass
- def login():
+ def login(self):
pass
- def moveFiles():
+ def moveFiles(self):
pass
- def movePackage():
+ def movePackage(self):
pass
- def orderFile():
+ def orderFile(self):
pass
- def orderPackage():
+ def orderPackage(self):
pass
- def parseURLs():
+ def parseURLs(self):
pass
- def pauseServer():
+ def pauseServer(self):
pass
- def pollResults():
+ def pollResults(self):
pass
- def pullFromQueue():
+ def pullFromQueue(self):
pass
- def pushToQueue():
+ def pushToQueue(self):
pass
- def recheckPackage():
+ def recheckPackage(self):
pass
- def removeAccount():
+ def removeAccount(self):
pass
- def restart():
+ def restart(self):
pass
- def restartFailed():
+ def restartFailed(self):
pass
- def restartFile():
+ def restartFile(self):
pass
- def restartPackage():
+ def restartPackage(self):
pass
- def setCaptchaResult():
+ def setCaptchaResult(self):
pass
- def setConfigValue():
+ def setConfigValue(self):
pass
- def setPackageData():
+ def setPackageData(self):
pass
- def setPackageName():
+ def setPackageName(self):
pass
- def statusDownloads():
+ def statusDownloads(self):
pass
- def statusServer():
+ def statusServer(self):
pass
- def stopAllDownloads():
+ def stopAllDownloads(self):
pass
- def stopDownloads():
+ def stopDownloads(self):
pass
- def togglePause():
+ def togglePause(self):
pass
- def toggleReconnect():
+ def toggleReconnect(self):
pass
- def unpauseServer():
+ def unpauseServer(self):
pass
- def updateAccount():
+ def updateAccount(self):
pass
- def uploadContainer():
+ def uploadContainer(self):
pass