From 97ae251a08aecfca6d9c8c7d8e31365cdc0ca3b0 Mon Sep 17 00:00:00 2001 From: Chri Date: Wed, 21 Jul 2010 15:15:16 +0200 Subject: [PATCH] Implement --debug, used to dump the first 'existing_file'. --- pl.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pl.py b/pl.py index 3f6eaa2..268dcd8 100755 --- a/pl.py +++ b/pl.py @@ -60,12 +60,13 @@ MUSIC_EXT = [ ] REPLACE_MARKER = '** please try to replace ** ' +DEBUG_FORMAT = '** DEBUG INFO: %s **' def main(): valid_actions = ['check', 'create'] parser = optparse.OptionParser() parser.usage = "%prog [OPTIONS...] ACTION PLAYLIST [OTHER_PLAYLIST]\n" + \ - " [-defhitV] [--delete] [--error-stop] [--fix] [--ignore-case]\n" + \ + " [-dDefhitV] [--debug] [--delete] [--error-stop] [--fix] [--ignore-case]\n" + \ " [-n NB_SUGGS] [-p PREFIX] [-s SCORE] [-t TARGET]\n" + \ " [--prefix PREFIX] [--score SCORE] [--target TARGET]\n" + \ " [--help] [--version]\n" + \ @@ -85,7 +86,10 @@ def main(): parser.add_option('-a', '--auto-fix', default=False, action='store_true', dest='auto_fix', help="check - change a missing entry to the first suggestion") - parser.add_option('-d', '--delete', default=False, + parser.add_option('-d', '--debug', default=False, + action='store_true', dest='debug', + help="print some info while running") + parser.add_option('-D', '--delete', default=False, action='store_true', dest='delete', help="check - delete entries that were not found") parser.add_option('-e', '--error-stop', default=False, @@ -157,6 +161,9 @@ def main(): bad_playlists = [] # build the list of present files existing_files = music_files_list(options.target, options.prefix) + if options.debug: + debug_info = "First file found: %s." % existing_files[0] + print DEBUG_FORMAT % debug_info if options.ignore_case: existing_files = [elt.lower() for elt in existing_files] for playlist in playlists: -- 2.45.1