mirror of
https://github.com/ciromattia/kcc
synced 2025-12-15 18:56:28 +00:00
Additional temp cleanup
This commit is contained in:
@@ -28,7 +28,7 @@ from urllib.request import Request, urlopen
|
|||||||
from re import sub
|
from re import sub
|
||||||
from stat import S_IWRITE, S_IREAD, S_IEXEC
|
from stat import S_IWRITE, S_IREAD, S_IEXEC
|
||||||
from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp, gettempdir
|
||||||
from shutil import move, copytree, rmtree
|
from shutil import move, copytree, rmtree
|
||||||
from optparse import OptionParser, OptionGroup
|
from optparse import OptionParser, OptionGroup
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
@@ -841,6 +841,13 @@ def sanitizePermissions(filetree):
|
|||||||
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD | S_IEXEC)
|
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD | S_IEXEC)
|
||||||
|
|
||||||
|
|
||||||
|
def sanitizeTemp():
|
||||||
|
for root, dirs, _ in walkLevel(gettempdir(), 0):
|
||||||
|
for tempdir in dirs:
|
||||||
|
if tempdir.startswith('KCC-'):
|
||||||
|
rmtree(os.path.join(root, tempdir), True)
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyUnboundLocalVariable
|
# noinspection PyUnboundLocalVariable
|
||||||
def splitDirectory(path):
|
def splitDirectory(path):
|
||||||
# Detect directory stucture
|
# Detect directory stucture
|
||||||
@@ -1216,6 +1223,7 @@ def makeBook(source, qtGUI=None):
|
|||||||
GUI.progressBarTick.emit('1')
|
GUI.progressBarTick.emit('1')
|
||||||
else:
|
else:
|
||||||
checkTools(source)
|
checkTools(source)
|
||||||
|
sanitizeTemp()
|
||||||
path = getWorkFolder(source)
|
path = getWorkFolder(source)
|
||||||
print("\nChecking images...")
|
print("\nChecking images...")
|
||||||
getComicInfo(os.path.join(path, "OEBPS", "Images"), source)
|
getComicInfo(os.path.join(path, "OEBPS", "Images"), source)
|
||||||
|
|||||||
Reference in New Issue
Block a user