From 455ad0f5cfd4ec02d161f16c83ddb027e52dae38 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Tue, 12 May 2020 16:54:22 +0200 Subject: Improved unique-making system The system for making file names unique is now safe, the file name will always be unique. --- filmstripper.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'filmstripper.py') 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() -- cgit v1.2.1