Added the --quiet option.

Gra [2009-05-25 20:50]
Added the --quiet option.
Filename
pl.py
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:
ViewGit