diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Hook.py | 13 | ||||
-rw-r--r-- | module/plugins/Hoster.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 9 | ||||
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/MultiHoster.py | 1 | ||||
-rw-r--r-- | module/plugins/internal/UnRar.py | 2 |
6 files changed, 18 insertions, 15 deletions
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index c0ce7d99c..83ef091ae 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -19,22 +19,25 @@ from traceback import print_exc -from functools import wraps +#from functools import wraps from module.utils import has_method from Base import Base +def class_name(p): + return p.rpartition(".")[2] + class Expose(object): """ used for decoration to declare rpc services """ def __new__(cls, f, *args, **kwargs): - hookManager.addRPC(f.__module__, f.func_name, f.func_doc) + hookManager.addRPC(class_name(f.__module__), f.func_name, f.func_doc) return f def AddEventListener(event): """ used to register method for events """ class _klass(object): def __new__(cls, f, *args, **kwargs): - hookManager.addEventListener(f.__module__, f.func_name, event) + hookManager.addEventListener(class_name(f.__module__), f.func_name, event) return f return _klass @@ -42,11 +45,11 @@ def AddEventListener(event): class ConfigHandler(object): """ register method as config handler """ def __new__(cls, f, *args, **kwargs): - hookManager.addConfigHandler(f.__module__, f.func_name) + hookManager.addConfigHandler(class_name(f.__module__), f.func_name) return f def threaded(f): - @wraps(f) + #@wraps(f) def run(*args,**kwargs): hookManager.startThread(f, *args, **kwargs) return run diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py index 54c2efdfd..bef4b1949 100644 --- a/module/plugins/Hoster.py +++ b/module/plugins/Hoster.py @@ -29,7 +29,7 @@ if os.name != "nt": from Base import Base, Fail, Retry from module.utils import chunks #legacy import -from module.utils.fs import save_join, save_path, fs_encode, fs_decode,\ +from module.utils.fs import save_join, save_filename, fs_encode, fs_decode,\ remove, makedirs, chmod, stat, exists, join @@ -339,7 +339,7 @@ class Hoster(Base): # convert back to unicode location = fs_decode(location) - name = save_path(self.pyfile.name) + name = save_filename(self.pyfile.name) filename = join(location, name) diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 2e77f1dae..39fe2b9f0 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -14,16 +14,15 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - @author: mkaay - @interface-version: 0.1 + @author: RaNaN """ import subprocess -from os import listdir, access, X_OK, makedirs -from os.path import join, exists, basename +from os import access, X_OK, makedirs +from os.path import basename from module.plugins.Hook import Hook -from module.utils import save_join +from module.utils.fs import save_join, exists, join, listdir class ExternalScripts(Hook): __name__ = "ExternalScripts" diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 82e9c1d36..d9c2e57bb 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -4,7 +4,7 @@ import sys import os from os import remove, chmod, makedirs -from os.path import exists, basename, isfile, isdir, join +from os.path import basename, isfile, isdir, join from traceback import print_exc from copy import copy @@ -48,7 +48,7 @@ if os.name != "nt": from pwd import getpwnam from grp import getgrnam -from module.utils import save_join, fs_encode +from module.utils.fs import save_join, fs_encode, exists from module.plugins.Hook import Hook, threaded, Expose from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword diff --git a/module/plugins/hooks/MultiHoster.py b/module/plugins/hooks/MultiHoster.py index 1f40a4ddd..749f2c104 100644 --- a/module/plugins/hooks/MultiHoster.py +++ b/module/plugins/hooks/MultiHoster.py @@ -69,6 +69,7 @@ class MultiHoster(Hook): def refreshAccounts(self, plugin=None, user=None): self.plugins = {} + for name, account in self.core.accountManager.iterAccounts(): if isinstance(account, MultiHosterAccount) and account.isUsable(): self.addHoster(account) diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index feac4c176..9f57a9ad6 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -23,7 +23,7 @@ from os.path import join from glob import glob from subprocess import Popen, PIPE -from module.utils import save_join, decode +from module.utils.fs import save_join, decode from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError, CRCError class UnRar(AbtractExtractor): |