diff options
Diffstat (limited to 'movietool')
-rwxr-xr-x | movietool/__init__.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/movietool/__init__.py b/movietool/__init__.py index 02bbd3f..33a0a5a 100755 --- a/movietool/__init__.py +++ b/movietool/__init__.py @@ -459,18 +459,26 @@ def do_rename(args): if result["alternative_title"] != result["title"]: print(" a.k.a.: {}".format(result["alternative_title"])) try: - select = int(input("Choose: ")) + select = input("Choose: ") + if not re.match("^[0-9]+$", select): + select = None + break + else: + select = int(select) except ValueError: pass + if not select: + print("Skip {}".format(input_file)) + continue + filename = "{alternative_title} ({year}) #{imdb_id}".format(**results[select-1]) filename = substitute_filename(filename) if os.path.exists(input_file): - choice = input("Move '{}' -> '{}' ? [y/N]: ".format(input_file, filename)).lower() - if choice == "y": - os.mkdir(filename) - shutil.move(input_file, filename) + print("Move '{}' -> '{}'".format(input_file, filename)) + os.mkdir(filename) + shutil.move(input_file, filename) else: print("mkdir '{}'".format(filename)) os.mkdir(filename) |