From 9565c2597345ff1f74307b13459a74395ac72fb9 Mon Sep 17 00:00:00 2001 From: Gra Date: Tue, 26 May 2009 18:15:40 +0200 Subject: [PATCH] Reworked the suggestion display. Factored out the number of suggestions to display. If 'fixing', display the item number. --- pl.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pl.py b/pl.py index 82b15b4..9a7920c 100755 --- a/pl.py +++ b/pl.py @@ -241,19 +241,24 @@ def playlist_is_ok(playlist, options): new=missing_item[len(options.target):]) else: print "could be" - for sugg in suggs[:5]: - print format_item(sugg, + nbr_of_suggestions = 5 + for sugg_idx in range(nbr_of_suggestions): + if options.fix: + print sugg_idx + 1, + print format_item(suggs[sugg_idx], options=options, indent=4) if options.fix: - replace = raw_input('Which one to use? [12345, nothing to ignore] ') + message = 'Which one to use? [%s, nothing to ignore] ' + seq = ''.join([str(num + 1) for num in range(nbr_of_suggestions)]) + replace = raw_input(message % seq) if replace.strip(): try: number = int(replace) - 1 except: number = -1 else: - if 0 <= number <= 4: + if 0 <= number < nbr_of_suggestions: new_playlist = replace_in_pl( pl=new_playlist, entry=missing_item[len(options.target):], -- 2.45.1