diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2011-11-22 15:51:43 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2011-11-22 15:51:43 +0100 |
commit | 4cb0beaccdd33940a7d640acb688e0673d356f36 (patch) | |
tree | cf5e3a24609c91a3a58496b6c0b8965563fcc734 /module/plugins/internal/SimpleHoster.py | |
parent | fix filepost (#431), hellspy, ifolder, letitbit, change SimpleHoster patterns (diff) | |
download | pyload-4cb0beaccdd33940a7d640acb688e0673d356f36.tar.xz |
add 2shared.com
Diffstat (limited to 'module/plugins/internal/SimpleHoster.py')
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 9eb9fd407..96824ffce 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -17,7 +17,7 @@ @author: zoidberg """ from urlparse import urlparse -from re import search +from re import search, sub from module.plugins.Hoster import Hoster from module.utils import html_unescape @@ -52,7 +52,12 @@ def parseFileInfo(self, url = '', html = ''): size = float(size) * 1024 ** self.SIZE_UNITS[units] status = 2 - if not name: name = url + if name: + for r in self.NAME_REPLACEMENTS: + rf, rt = r + name = sub(rf, rt, name) + else: + name = url return name, size, status, url @@ -81,8 +86,10 @@ class SimpleHoster(Hoster): __author_mail__ = ("zoidberg@mujmail.cz") #TODO: could be replaced when using utils.parseFileSize ? + #some plugins need to override these SIZE_UNITS = {'k': 1, 'K': 1, 'M': 2, 'G': 3} SIZE_REPLACEMENTS = {',': '', ' ': ''} + NAME_REPLACEMENTS = [] def setup(self): self.resumeDownload = self.multiDL = True if self.account else False |