Private GIT

Skip to content
Snippets Groups Projects
Commit 4e45c94f authored by Ruud's avatar Ruud
Browse files

Renamer NTFS permission fix #778

parent 0a11dc66
Branches
No related tags found
No related merge requests found
from couchpotato.core.plugins.renamer.main import Renamer from couchpotato.core.plugins.renamer.main import Renamer
import os
def start(): def start():
return Renamer() return Renamer()
...@@ -111,6 +112,15 @@ config = [{ ...@@ -111,6 +112,15 @@ config = [{
'label': 'Separator', 'label': 'Separator',
'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.', 'description': 'Replace all the spaces with a character. Example: ".", "-" (without quotes). Leave empty to use spaces.',
}, },
{
'advanced': True,
'name': 'ntfs_permission',
'label': 'NTFS Permission',
'type': 'bool',
'hidden': os.name != 'nt',
'description': 'Set permission of moved files to that of destination folder (Windows NTFS only).',
'default': False,
},
], ],
}, { }, {
'tab': 'renamer', 'tab': 'renamer',
......
...@@ -455,6 +455,8 @@ class Renamer(Plugin): ...@@ -455,6 +455,8 @@ class Renamer(Plugin):
try: try:
os.chmod(dest, Env.getPermission('file')) os.chmod(dest, Env.getPermission('file'))
if os.name == 'nt' and self.conf('ntfs_permission'):
os.popen('icacls "' + dest + '"* /reset /T')
except: except:
log.error('Failed setting permissions for file: %s, %s', (dest, traceback.format_exc(1))) log.error('Failed setting permissions for file: %s, %s', (dest, traceback.format_exc(1)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment