summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hoster/BasePlugin.py4
-rw-r--r--module/plugins/hoster/UploadedTo.py18
-rw-r--r--module/plugins/internal/MultiHoster.py4
3 files changed, 15 insertions, 11 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index 15e35ce24..2de47940d 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -6,7 +6,7 @@ from urllib import unquote
from module.network.HTTPRequest import BadHeader
from module.plugins.Hoster import Hoster
-from module.utils import html_unescape, removeChars
+from module.utils import html_unescape, remove_chars
class BasePlugin(Hoster):
__name__ = "BasePlugin"
@@ -80,7 +80,7 @@ class BasePlugin(Hoster):
disp = m.groupdict()
self.logDebug(disp)
if not disp['enc']: disp['enc'] = 'utf-8'
- name = removeChars(disp['name'], "\"';").strip()
+ name = remove_chars(disp['name'], "\"';").strip()
name = unicode(unquote(name), disp['enc'])
if not name: name = url
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index 7ef39bf57..174c386a8 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -2,14 +2,13 @@
import re
-from module.utils import decode, html_unescape
+from module.utils import html_unescape, parseFileSize
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
from module.plugins.Plugin import chunks
from module.plugins.ReCaptcha import ReCaptcha
-#key = reduce(lambda x,y: x+chr(y), [(i+2)^ord(x) for i,x in enumerate("jS1\\50}eSm~5i\\cB+$XVB s^/\\mm&JUF")], "")
key = "bGhGMkllZXByd2VEZnU5Y2NXbHhYVlZ5cEE1bkEzRUw=".decode('base64')
def correctDownloadLink(url):
@@ -41,7 +40,7 @@ def getAPIData(urls):
result = {}
- if len(api):
+ if api:
for line in api.splitlines():
data = line.split(",")
if data[1] in idMap:
@@ -60,7 +59,7 @@ def parseFileInfo(self, url = '', html = ''):
found = re.search(self.FILE_INFO_PATTERN, html)
if found:
name, fileid = html_unescape(found.group('N')), found.group('ID')
- size = float(found.group('S').replace(',','.')) * 1024 ** {'K':1,'M':2,'G':3}[found.group('U')]
+ size = parseFileSize(found.group('S'), found.group('U'))
status = 2
return name, size, status, fileid
@@ -114,18 +113,23 @@ class UploadedTo(Hoster):
api = getAPIData([pyfile.url])
- if not len(api):
+ # TODO: fallback to parse from site, because api sometimes delivers wrong status codes
+
+ if not api:
self.logWarning("No response for API call")
self.html = unicode(self.load(pyfile.url, decode = False), 'iso-8859-1')
name, size, status, self.fileID = parseFileInfo(self)
self.logDebug(name, size, status, self.fileID)
if status == 1:
- self.offline
+ self.offline()
elif status == 2:
pyfile.name, pyfile.size = name, size
else:
self.fail('Parse error - file info')
+ elif api == 'Access denied':
+ self.fail(_("API key invalid"))
+
else:
if self.fileID not in api:
self.offline()
@@ -138,7 +142,7 @@ class UploadedTo(Hoster):
# self.pyfile.name = self.get_file_name()
- if self.account and self.premium:
+ if self.premium:
self.handlePremium()
else:
self.handleFree()
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 6f0b4b636..d50df3943 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -3,7 +3,7 @@
import re
-from module.utils import removeChars
+from module.utils import remove_chars
from module.plugins.Hook import Hook
class MultiHoster(Hook):
@@ -49,7 +49,7 @@ class MultiHoster(Hook):
new_supported = []
for hoster in self.getHosterCached():
- name = removeChars(hoster.lower(), "-.")
+ name = remove_chars(hoster.lower(), "-.")
if name in pluginMap:
self.supported.append(pluginMap[name])