Reworked the suggestion display.

Gra [2009-05-26 16:15]
Reworked the suggestion display.

Factored out the number of suggestions to display.
If 'fixing', display the item number.
Filename
pl.py
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):],
ViewGit