From 9a64c65fee13eb467a53c18d8e94d161faeac758 Mon Sep 17 00:00:00 2001 From: Gra Date: Mon, 25 May 2009 22:50:11 +0200 Subject: [PATCH] Added the --quiet option. --- pl.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pl.py b/pl.py index a76b116..f5e08f2 100755 --- a/pl.py +++ b/pl.py @@ -92,6 +92,9 @@ def main(): action='store', dest='prefix', type='string', help="the string that will replace TARGET in the created playlist, " "typically TARGET without the path of your player") + parser.add_option('-q', '--quiet', default=False, + action='store_true', dest='quiet', + help="check - don't report clean playlists") parser.add_option('-s', '--score', default=1, action='store', dest='score', type='float', help="minimum matching score for suggestions, " @@ -163,11 +166,11 @@ def playlist_is_ok(playlist, options): print "Couldn't read this playlist: %s." % playlist return False - print "Opening %s..." % playlist, items = pl_file.readlines() pl_file.close() if not items: - print "The playlist is empty." + if not options.quiet: + print "%s is empty." % playlist # this is not a problem to be reported globally, we return True return True else: @@ -191,15 +194,16 @@ def playlist_is_ok(playlist, options): # copy this line new_playlist.append(item) if not missing_items: - print "OK" + if not options.quiet: + print "%s is OK." % playlist return True else: missing_items = sorted(missing_items) if len(missing_items) == 1: - tpl = "%d file was not found:" + tpl = "%d file was not found in %s:" else: - tpl = "%d files were not found:" - print tpl % len(missing_items) + tpl = "%d files were not found in %s:" + print tpl % (len(missing_items), playlist) # maybe we have to find suggestions (display to user or auto-fix) # so we initialize the score dict and the seq matcher if options.score < 1: -- 2.45.1