From 40cb963c99d0e9409a8eeb72253ab3f8713b3249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 2 Aug 2013 10:52:51 +0200 Subject: [PATCH] Improved handling of slugification conflicts --- kcc/comic2ebook.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index d944fb8..056c3fb 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -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()