aboutsummaryrefslogtreecommitdiff
path: root/filmstripper.py
diff options
context:
space:
mode:
authorSan Jacobs2020-05-12 16:54:22 +0200
committerSan Jacobs2020-05-12 16:54:22 +0200
commit455ad0f5cfd4ec02d161f16c83ddb027e52dae38 (patch)
tree8ea3ab58cebda8394d4a520243978af3208534e2 /filmstripper.py
parentcee3e2d1c7db5bb341bb73af4fda5566bd63870b (diff)
downloadfilmstripper-455ad0f5cfd4ec02d161f16c83ddb027e52dae38.tar.gz
filmstripper-455ad0f5cfd4ec02d161f16c83ddb027e52dae38.tar.bz2
filmstripper-455ad0f5cfd4ec02d161f16c83ddb027e52dae38.zip
Improved unique-making system
The system for making file names unique is now safe, the file name will always be unique.
Diffstat (limited to 'filmstripper.py')
-rw-r--r--filmstripper.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/filmstripper.py b/filmstripper.py
index 73527dc..4bf2ff5 100644
--- a/filmstripper.py
+++ b/filmstripper.py
@@ -49,10 +49,11 @@ if path.isfile(outputFile):
elif answer == "C" or answer == "c":
broke = True
elif answer == "U" or answer == "u":
- index = outputFile.find(".")
- newName = outputFile[:index] + str(random.randint(1000, 9999)) + outputFile[index:]
- print("New output filename: "+newName)
- outputFile = newName
+ while path.isfile(outputFile):
+ index = outputFile.find(".")
+ newName = outputFile[:index] + str(random.randint(0, 9)) + outputFile[index:]
+ print("New output filename: "+newName)
+ outputFile = newName
brkck()