Make --funky print what it should. Normalise() is now __call__()

This commit is contained in:
Kjistóf 2017-08-23 23:27:50 +02:00 committed by Kristóf Tóth
parent 57d0ab4650
commit 24cd974129

View File

@ -32,7 +32,7 @@ class normalisename:
self._separator = separator self._separator = separator
self._whitelist = set(whitelist) self._whitelist = set(whitelist)
def normalise(self, files): def __call__(self, files):
for path in files: for path in files:
if not self.check_normal(path): if not self.check_normal(path):
dir = dirname(path) dir = dirname(path)
@ -85,11 +85,11 @@ if __name__ == '__main__':
# define operations # define operations
listchanges = lambda a, b: print('{}{} --> {}'.format(a, ' '*(60-len(a)), b)) listchanges = lambda a, b: print('{}{} --> {}'.format(a, ' '*(60-len(a)), b))
listfunky = lambda a, b: print(b) listfunky = lambda a, b: print(a)
operation = rename operation = rename
if args.dryrun: operation = listchanges if args.dryrun: operation = listchanges
elif args.funky: operation = listfunky elif args.funky: operation = listfunky
# do what needs to be done
normalisename(operation, args.separator, whitelist).normalise(args.files) normalisename(operation, args.separator, whitelist)(args.files)