summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2015-03-28 18:35:20 +0100
committerYves Fischer <yvesf-git@xapek.org>2015-03-28 18:40:11 +0100
commit3c0d14ee39432705f9937ae4ac7a149d19ae4f1c (patch)
treea25667fd2dff133686cee08449b5795f9e306890
parent915836963984be827ddcf56da33af39d40f73be9 (diff)
downloadmovietool-3c0d14ee39432705f9937ae4ac7a149d19ae4f1c.tar.gz
movietool-3c0d14ee39432705f9937ae4ac7a149d19ae4f1c.zip
improve 'rename' command
-rwxr-xr-xmovietool/__init__.py18
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)