Added a function to format items.

Gra [2009-05-26 14:22]
Added a function to format items.

This is used to remove the target in the path.
Filename
pl.py
diff --git a/pl.py b/pl.py
index f5e08f2..38cb44a 100755
--- a/pl.py
+++ b/pl.py
@@ -213,7 +213,7 @@ def playlist_is_ok(playlist, options):
                 seqmatcher = difflib.SequenceMatcher()
             # this is the report
             for missing_item in missing_items:
-                print "  " + missing_item,
+                print "  " + format_item(missing_item, options=options),
                 if options.score < 1:
                     seqmatcher.set_seq1(os.path.basename(missing_item))
                     for filename in scores:
@@ -235,7 +235,7 @@ def playlist_is_ok(playlist, options):
                     else:
                         print "could be"
                         for sugg in suggs[:5]:
-                            print "    " + sugg
+                            print "    " + format_item(sugg, options=options)
                         if options.fix:
                             replace = raw_input('Which one to use? [12345, nothing to ignore] ')
                             if replace.strip():
@@ -298,6 +298,9 @@ def replace_in_pl(pl, entry, new):
     print new_pl
     return new_pl

+def format_item(item, options):
+    return item[len(options.target):]
+
 def print_version(_option, _opt_str, _value, _parser):
     print "playlist_checker %s" % VERSION
     sys.exit()
ViewGit