1
0
mirror of https://github.com/ciromattia/kcc synced 2026-01-30 17:07:41 +00:00

Improved handling of slugification conflicts

This commit is contained in:
Paweł Jastrzębski
2013-08-02 10:52:51 +02:00
parent 9d267a6cc4
commit 40cb963c99

View File

@@ -654,13 +654,16 @@ def sanitizeTree(filetree):
splitname = os.path.splitext(name)
slugified = slugify(splitname[0])
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]))
for name in dirs:
if name.startswith('.'):
os.remove(os.path.join(root, name))
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):
@@ -842,11 +845,6 @@ def checkOptions():
options.profileData = image.ProfileData.Profiles[options.profile]
def getEpubPath():
global epub_path
return epub_path
if __name__ == "__main__":
freeze_support()
Copyright()