diff options
author | San Jacobs | 2020-02-26 05:57:50 +0100 |
---|---|---|
committer | San Jacobs | 2020-02-26 05:57:50 +0100 |
commit | cce186b0e9d4dbe8e929fbf933ed093088eb1214 (patch) | |
tree | 4786044c0f9b94e5a92fcb58f177310c6dbd6f87 | |
parent | 75304933463483bfe535c721f2273c42ea46b8b0 (diff) | |
download | filmstripper-cce186b0e9d4dbe8e929fbf933ed093088eb1214.tar.gz filmstripper-cce186b0e9d4dbe8e929fbf933ed093088eb1214.tar.bz2 filmstripper-cce186b0e9d4dbe8e929fbf933ed093088eb1214.zip |
Added file overwrite warning
-rw-r--r-- | filmstripper.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/filmstripper.py b/filmstripper.py index 52fa682..76db78e 100644 --- a/filmstripper.py +++ b/filmstripper.py @@ -1,6 +1,8 @@ from PIL import Image import glob import sys +import random +from os import path broke = False @@ -33,6 +35,19 @@ except: print("ERROR: Output file argument invalid.") broke = True +if path.isfile(outputFile): + print("Output file already exists. What would you like to do? Overwrite, Cancel or Unique?") + answer = input("[O/C/U]: ") + if answer == "O" or answer == "o": + None + 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 + brkck() try: |