mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
add folder permissions for sub directories. Fixes #609
This commit is contained in:
parent
840ca685c6
commit
9b28fff338
1 changed files with 10 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
from subprocess import call, Popen
|
from subprocess import call, Popen
|
||||||
|
@ -90,7 +91,10 @@ def extract(filePath, outputDestination):
|
||||||
nzbtomedia.logger.debug("Extracting %s %s %s" % (cmd, filePath, outputDestination))
|
nzbtomedia.logger.debug("Extracting %s %s %s" % (cmd, filePath, outputDestination))
|
||||||
|
|
||||||
origFiles = []
|
origFiles = []
|
||||||
|
origDirs = []
|
||||||
for dir, subdirs, files in os.walk(outputDestination):
|
for dir, subdirs, files in os.walk(outputDestination):
|
||||||
|
for subdir in subdirs:
|
||||||
|
origDirs.append(os.path.join(dir, subdir))
|
||||||
for file in files:
|
for file in files:
|
||||||
origFiles.append(os.path.join(dir, file))
|
origFiles.append(os.path.join(dir, file))
|
||||||
|
|
||||||
|
@ -136,7 +140,13 @@ def extract(filePath, outputDestination):
|
||||||
if success:
|
if success:
|
||||||
# sleep to let files finish writing to disk
|
# sleep to let files finish writing to disk
|
||||||
sleep (3)
|
sleep (3)
|
||||||
|
perms = oct(stat.S_IMODE(os.lstat(filePath).st_mode))
|
||||||
for dir, subdirs, files in os.walk(outputDestination):
|
for dir, subdirs, files in os.walk(outputDestination):
|
||||||
|
for subdir in subdirs:
|
||||||
|
if not os.path.join(dir, subdir) in origFiles:
|
||||||
|
try:
|
||||||
|
os.chmod(os.path.join(dir, file), perms)
|
||||||
|
except: pass
|
||||||
for file in files:
|
for file in files:
|
||||||
if not os.path.join(dir, file) in origFiles:
|
if not os.path.join(dir, file) in origFiles:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue