mirror of
https://github.com/ciromattia/kcc
synced 2026-07-23 21:23:10 +00:00
Improved handling of slugification conflicts
This commit is contained in:
+5
-7
@@ -654,13 +654,16 @@ def sanitizeTree(filetree):
|
|||||||
splitname = os.path.splitext(name)
|
splitname = os.path.splitext(name)
|
||||||
slugified = slugify(splitname[0])
|
slugified = slugify(splitname[0])
|
||||||
while os.path.exists(os.path.join(root, slugified + splitname[1])):
|
while os.path.exists(os.path.join(root, slugified + splitname[1])):
|
||||||
slugified += "1"
|
slugified += "A"
|
||||||
os.rename(os.path.join(root, name), os.path.join(root, slugified + splitname[1]))
|
os.rename(os.path.join(root, name), os.path.join(root, slugified + splitname[1]))
|
||||||
for name in dirs:
|
for name in dirs:
|
||||||
if name.startswith('.'):
|
if name.startswith('.'):
|
||||||
os.remove(os.path.join(root, name))
|
os.remove(os.path.join(root, name))
|
||||||
else:
|
else:
|
||||||
os.rename(os.path.join(root, name), os.path.join(root, slugify(name)))
|
slugified = slugify(name)
|
||||||
|
while os.path.exists(os.path.join(root, slugified)):
|
||||||
|
slugified += "A"
|
||||||
|
os.rename(os.path.join(root, name), os.path.join(root, slugified))
|
||||||
|
|
||||||
|
|
||||||
def sanitizeTreeBeforeConversion(filetree):
|
def sanitizeTreeBeforeConversion(filetree):
|
||||||
@@ -842,11 +845,6 @@ def checkOptions():
|
|||||||
options.profileData = image.ProfileData.Profiles[options.profile]
|
options.profileData = image.ProfileData.Profiles[options.profile]
|
||||||
|
|
||||||
|
|
||||||
def getEpubPath():
|
|
||||||
global epub_path
|
|
||||||
return epub_path
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
freeze_support()
|
freeze_support()
|
||||||
Copyright()
|
Copyright()
|
||||||
|
|||||||
Reference in New Issue
Block a user