Add option to supress fancy output
This commit is contained in:
parent
bf828bbac5
commit
05e077105a
@ -55,6 +55,7 @@ if __name__ == '__main__':
|
|||||||
ap = ArgumentParser()
|
ap = ArgumentParser()
|
||||||
ap.add_argument('images', type=str, nargs='+', help='')
|
ap.add_argument('images', type=str, nargs='+', help='')
|
||||||
ap.add_argument('-d', '--delete', action='store_true', help='Delete all but the best quality image.')
|
ap.add_argument('-d', '--delete', action='store_true', help='Delete all but the best quality image.')
|
||||||
|
ap.add_argument('-q', '--quiet', action='store_true', help='Print quality measurements only.')
|
||||||
return ap.parse_args()
|
return ap.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@ -63,8 +64,11 @@ if __name__ == '__main__':
|
|||||||
maximum = max(ratings, key=ratings.get)
|
maximum = max(ratings, key=ratings.get)
|
||||||
|
|
||||||
for rating in ratings.keys():
|
for rating in ratings.keys():
|
||||||
maxmark = '*' if rating == maximum and len(ratings) > 1 else ' '
|
if args.quiet:
|
||||||
print('{}imgrate("{}") = {}'.format(maxmark, rating, ratings[rating]))
|
print(ratings[rating])
|
||||||
|
else:
|
||||||
|
maxmark = '*' if rating == maximum and len(ratings) > 1 else ' '
|
||||||
|
print('{}imgrate("{}") = {}'.format(maxmark, rating, ratings[rating]))
|
||||||
|
|
||||||
if args.delete:
|
if args.delete:
|
||||||
[remove(image) for image in ratings if image != maximum]
|
[remove(image) for image in ratings if image != maximum]
|
||||||
|
Loading…
Reference in New Issue
Block a user