From 48f3e82bae80e10b3b6722508cdc7f7a0b72736a Mon Sep 17 00:00:00 2001 From: Gra Date: Tue, 26 May 2009 16:22:43 +0200 Subject: [PATCH] Added a function to format items. This is used to remove the target in the path. --- pl.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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() -- 2.45.1