diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-16 20:48:58 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-16 20:48:58 +0200 |
commit | 1486c0164b6ba2e20ce4513010c11c3a638f4b50 (patch) | |
tree | f508e27c52f2284b01bd41bf3d2fbf0bdc3a34e4 /module | |
parent | unrar fix (diff) | |
download | pyload-1486c0164b6ba2e20ce4513010c11c3a638f4b50.tar.xz |
permission settings
Diffstat (limited to 'module')
-rw-r--r-- | module/ConfigParser.py | 2 | ||||
-rw-r--r-- | module/config/default.conf | 8 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 12 |
3 files changed, 19 insertions, 3 deletions
diff --git a/module/ConfigParser.py b/module/ConfigParser.py index 568d22db9..7e1af042e 100644 --- a/module/ConfigParser.py +++ b/module/ConfigParser.py @@ -246,6 +246,8 @@ class ConfigParser: return int(value) elif typ == "bool": return True if value.lower() in ("1","true", "on", "an","yes") else False + elif typ == "str": + return str(value) else: return value diff --git a/module/config/default.conf b/module/config/default.conf index f9c4ecc3b..eaa27f596 100644 --- a/module/config/default.conf +++ b/module/config/default.conf @@ -31,6 +31,14 @@ general - "General": bool folder_per_package : "Create folder for each package" = True
bool skip_existing : "Skip already existing files" = False
ip download_interface : "Outgoing IP address for downloads" = None
+permission - "Permissions":
+ bool change_user : "Change user of running process" = False
+ str user : "Username" = "user"
+ str folder : "Folder Permission mode" = 0755
+ bool change_file : "Change file mode of downloads" = False
+ str file : "Filemode for Downloads" = 0644
+ bool change_group : "Change group of running process" = False
+ str group : "Groupname" = users
reconnect - "Reconnect":
bool activated : "Use Reconnect" = False
str method : "Method" = None
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 449a032a7..77e4e8183 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -30,6 +30,7 @@ from os.path import exists from os import remove from os import makedirs +from os import chmod from mimetypes import guess_type @@ -257,12 +258,17 @@ class Plugin(object): location = join(download_folder.encode(sys.getfilesystemencoding(), "replace"), self.pyfile.package().folder.replace(":", "").encode(sys.getfilesystemencoding(), "replace")) # remove : for win compability - if not exists(location): - makedirs(location) + if not exists(location): + makedirs(location, int(self.core.config["permission"]["folder"],8)) - newname = self.req.download(url, self.pyfile.name.encode(sys.getfilesystemencoding(), "replace"), location, get, post, ref, cookies) + name = self.pyfile.name.encode(sys.getfilesystemencoding(), "replace") + newname = self.req.download(url, name, location, get, post, ref, cookies) self.pyfile.size = self.req.dl_size if newname: + name = newname self.pyfile.name = newname + + if self.core.config["permission"]["change_file"]: + chmod(join(location, name), int(self.core.config["permission"]["file"],8)) |