From 68ce476299703f731c0414911b390814cf971672 Mon Sep 17 00:00:00 2001 From: Erik Hahn Date: Fri, 31 Jul 2009 01:13:38 +0200 Subject: [PATCH] Remove target parameter It isn't used anyway, the information is conatined within pattern --- ordnung.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/ordnung.py b/ordnung.py index bc02474..1bc0d3a 100644 --- a/ordnung.py +++ b/ordnung.py @@ -13,7 +13,7 @@ def issupportedfile(name): return True return False -def newpath(file, target, pattern): +def newpath(file, pattern): # Create the tokens dictionary tokens = {} tags = tag(file) @@ -27,9 +27,6 @@ def newpath(file, target, pattern): if tokens["album artist"] == None: tokens["album artist"] = tokens["artist"] - # That appears in no tag - tokens["base"] = target - # Now replace all tokens by their values for i in tokens: repl = "%" + i + "%" @@ -51,13 +48,10 @@ def safeprint(string): except UnicodeEncodeError: print string.encode("utf-8") -def files_to_move(base_dir, pattern, target_dir=None, recursive=False): +def files_to_move(base_dir, pattern, recursive=False): """ Figure out which files to move where """ - if target_dir == None: - target_dir = base_dir - basepath = path(base_dir) if recursive: files = basepath.walkfiles() @@ -69,7 +63,7 @@ def files_to_move(base_dir, pattern, target_dir=None, recursive=False): for file in files: if issupportedfile(file): - t = [ file, newpath(file, target_dir, pattern) ] + t = [ file, newpath(file, pattern) ] files_return.append(t) return files_return @@ -82,8 +76,6 @@ def main(): help="action to execute. Possible values: preview (default), move, copy", default="preview") parser.add_option("-r", "--recursive", action="store_true", dest="recursive", help="also move/copy files from sub-directories", default=False) - parser.add_option("-t", "--target", dest="target", - help="create new directory structure in directory TARGET (default=directory)") (options, args) = parser.parse_args() try: @@ -98,7 +90,7 @@ def main(): print "You must specify a pattern" sys.exit() - for i in files_to_move(target_dir=options.target, base_dir=base, + for i in files_to_move(base_dir=base, pattern=pattern, recursive=options.recursive): if options.action == "preview": safeprint (i[0] + " --> " + i[1]) -- 2.11.4.GIT