diff options
Diffstat (limited to 'pyload')
-rw-r--r-- | pyload/plugins/accounts/Premium4Me.py | 11 | ||||
-rw-r--r-- | pyload/plugins/addons/MultiHoster.py | 5 | ||||
-rw-r--r-- | pyload/plugins/hoster/Premium4Me.py | 5 | ||||
-rw-r--r-- | pyload/utils/__init__.py | 23 |
4 files changed, 22 insertions, 22 deletions
diff --git a/pyload/plugins/accounts/Premium4Me.py b/pyload/plugins/accounts/Premium4Me.py index fbca3ce84..3b0d24488 100644 --- a/pyload/plugins/accounts/Premium4Me.py +++ b/pyload/plugins/accounts/Premium4Me.py @@ -1,6 +1,7 @@ -from module.plugins.Account import Account -class Premium4Me(Account): +from pyload.plugins.MultiHoster import MultiHoster + +class Premium4Me(MultiHoster): __name__ = "Premium4Me" __version__ = "0.03" __type__ = "account" @@ -20,4 +21,8 @@ class Premium4Me(Account): self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % (user, data["password"])).strip() if "wrong username" in self.authcode: - self.wrongPassword()
\ No newline at end of file + self.wrongPassword() + + def loadHosterList(self, req): + page = req.load("http://premium.to/api/hosters.php?authcode=%s" % self.authcode) + return [x.strip() for x in page.replace("\"", "").split(";")]
\ No newline at end of file diff --git a/pyload/plugins/addons/MultiHoster.py b/pyload/plugins/addons/MultiHoster.py index b7873a3a2..7ff6b834e 100644 --- a/pyload/plugins/addons/MultiHoster.py +++ b/pyload/plugins/addons/MultiHoster.py @@ -26,7 +26,7 @@ class MultiHoster(Addon): def addHoster(self, account): - self.logInfo(_("Added MultiHoster %s") % account.__name__) + self.logInfo(_("Activated MultiHoster %s") % account.__name__) pluginMap = {} for name in self.core.pluginManager.getPlugins("hoster").keys(): @@ -62,12 +62,13 @@ class MultiHoster(Addon): # recreate plugin tuple for new regexp hoster = self.core.pluginManager.getPlugins("hoster") p = hoster[account.__name__] - new = PluginTuple(p.version, re.compile(regexp), p.deps, p.user, p.path) + new = PluginTuple(p.version, re.compile(regexp), p.deps, p.category, p.user, p.path) hoster[account.__name__] = new @AddEventListener("account:deleted") def refreshAccounts(self, plugin=None, user=None): + self.logDebug("Re-checking accounts") self.plugins = {} for name, account in self.core.accountManager.iterAccounts(): diff --git a/pyload/plugins/hoster/Premium4Me.py b/pyload/plugins/hoster/Premium4Me.py index 502e9ff12..582e3fc3a 100644 --- a/pyload/plugins/hoster/Premium4Me.py +++ b/pyload/plugins/hoster/Premium4Me.py @@ -5,9 +5,8 @@ from urllib import quote from os.path import exists from os import remove -from module.plugins.Hoster import Hoster -from module.utils import fs_encode - +from pyload.plugins.Hoster import Hoster +from pyload.utils.fs import fs_encode class Premium4Me(Hoster): __name__ = "Premium4Me" diff --git a/pyload/utils/__init__.py b/pyload/utils/__init__.py index ca00f9abe..da7b81af7 100644 --- a/pyload/utils/__init__.py +++ b/pyload/utils/__init__.py @@ -19,25 +19,20 @@ json_loads = json.loads json_dumps = json.dumps def decode(string): - """ decode string with utf if possible """ - try: - if type(string) == str: - return string.decode("utf8", "replace") - else: - return string - except: + """ decode string to unicode with utf8 """ + if type(string) == str: + return string.decode("utf8", "replace") + else: return string def encode(string): - """ decode string to utf if possible """ - try: - if type(string) == unicode: - return string.encode("utf8", "replace") - else: - return string - except: + """ decode string to utf8 """ + if type(string) == unicode: + return string.encode("utf8", "replace") + else: return string + def remove_chars(string, repl): """ removes all chars in repl from string""" if type(string) == str: |