mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 17:56:30 +00:00
Miscellaneous fixes
This commit is contained in:
@@ -107,7 +107,7 @@ def buildHTML(path, imgfile, imgfilepath):
|
||||
os.makedirs(htmlpath)
|
||||
htmlfile = os.path.join(htmlpath, filename[0] + '.xhtml')
|
||||
f = open(htmlfile, "w", encoding='UTF-8')
|
||||
f.writelines(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
|
||||
f.writelines(["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",
|
||||
"<!DOCTYPE html>\n",
|
||||
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n",
|
||||
"<head>\n",
|
||||
@@ -211,8 +211,7 @@ def buildNCX(dstdir, title, chapters, chapterNames):
|
||||
"<meta name=\"generated\" content=\"true\"/>\n",
|
||||
"</head>\n",
|
||||
"<docTitle><text>", escape(title), "</text></docTitle>\n",
|
||||
"<navMap>"
|
||||
])
|
||||
"<navMap>\n"])
|
||||
for chapter in chapters:
|
||||
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
|
||||
filename = getImageFileName(os.path.join(folder, chapter[1]))
|
||||
@@ -253,8 +252,7 @@ def buildNAV(dstdir, title, chapters, chapterNames):
|
||||
f.writelines(["</ol>\n",
|
||||
"</nav>\n",
|
||||
"<nav epub:type=\"page-list\">\n",
|
||||
"<ol>\n"
|
||||
])
|
||||
"<ol>\n"])
|
||||
for chapter in chapters:
|
||||
folder = chapter[0].replace(os.path.join(dstdir, 'OEBPS'), '').lstrip('/').lstrip('\\\\')
|
||||
filename = getImageFileName(os.path.join(folder, chapter[1]))
|
||||
|
||||
@@ -97,27 +97,27 @@ def check7ZFile(filePath):
|
||||
|
||||
|
||||
def saferReplace(old, new):
|
||||
for x in range(50):
|
||||
for x in range(10):
|
||||
try:
|
||||
os.replace(old, new)
|
||||
except PermissionError:
|
||||
sleep(0.1)
|
||||
sleep(1)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
raise PermissionError
|
||||
raise PermissionError("Failed to move the file.")
|
||||
|
||||
|
||||
def saferRemove(target):
|
||||
for x in range(50):
|
||||
for x in range(10):
|
||||
try:
|
||||
os.remove(target)
|
||||
except PermissionError:
|
||||
sleep(0.1)
|
||||
sleep(1)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
raise PermissionError
|
||||
raise PermissionError("Failed to remove the file.")
|
||||
|
||||
|
||||
def removeFromZIP(zipfname, *filenames):
|
||||
@@ -146,7 +146,7 @@ def sanitizeTrace(traceback):
|
||||
return ''.join(format_tb(traceback))\
|
||||
.replace('C:\\Users\\pawel\\Documents\\Projekty\\KCC\\', '')\
|
||||
.replace('C:\\Python34\\', '')\
|
||||
.replace('C:\\Python34_64\\', '')
|
||||
.replace('c:\\python34\\', '')
|
||||
|
||||
|
||||
def dependencyCheck(level):
|
||||
|
||||
Reference in New Issue
Block a user