diff options
Diffstat (limited to 'module/plugins/Plugin.py')
-rw-r--r-- | module/plugins/Plugin.py | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index d23c0cfcb..8a2554ea0 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -1,22 +1,5 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - 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: RaNaN, spoob, mkaay -""" - from time import time, sleep from random import randint @@ -143,14 +126,17 @@ class Plugin(Base): Overwrite `process` / `decrypt` in your subclassed plugin. """ __name__ = "Plugin" + __type__ = "hoster" __version__ = "0.5" + __pattern__ = None - __type__ = "hoster" __config__ = [("name", "type", "desc", "default")] + __description__ = """Base plugin""" __author_name__ = ("RaNaN", "spoob", "mkaay") __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de") + def __init__(self, pyfile): Base.__init__(self, pyfile.m.core) @@ -225,8 +211,8 @@ class Plugin(Base): def getChunkCount(self): if self.chunkLimit <= 0: - return self.config["download"]["chunks"] - return min(self.config["download"]["chunks"], self.chunkLimit) + return self.config['download']['chunks'] + return min(self.config['download']['chunks'], self.chunkLimit) def __call__(self): return self.__name__ @@ -504,12 +490,12 @@ class Plugin(Base): location = safe_join(download_folder, self.pyfile.package().folder) if not exists(location): - makedirs(location, int(self.config["permission"]["folder"], 8)) + makedirs(location, int(self.config['permission']['folder'], 8)) - if self.config["permission"]["change_dl"] and os.name != "nt": + if self.config['permission']['change_dl'] and os.name != "nt": try: - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + uid = getpwnam(self.config['permission']['user'])[2] + gid = getgrnam(self.config['permission']['group'])[2] chown(location, uid, gid) except Exception, e: @@ -537,13 +523,13 @@ class Plugin(Base): fs_filename = fs_encode(filename) - if self.config["permission"]["change_file"]: - chmod(fs_filename, int(self.config["permission"]["file"], 8)) + if self.config['permission']['change_file']: + chmod(fs_filename, int(self.config['permission']['file'], 8)) - if self.config["permission"]["change_dl"] and os.name != "nt": + if self.config['permission']['change_dl'] and os.name != "nt": try: - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + uid = getpwnam(self.config['permission']['user'])[2] + gid = getgrnam(self.config['permission']['group'])[2] chown(fs_filename, uid, gid) except Exception, e: |