From 25add4239d19315b00d89091c558edc3706339a1 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Thu, 10 Nov 2022 10:11:42 +0000 Subject: [PATCH] Limit matching tracks on import to five --- app/musicmuster.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/musicmuster.py b/app/musicmuster.py index 51d78b3..c0cbe45 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -666,11 +666,15 @@ class Window(QMainWindow, Ui_MainWindow): artist = tags['artist'] possible_matches = Tracks.search_titles(session, title) if possible_matches: - txt += 'Similar to new track ' - txt += f'"{title}" by "{artist} ({fname})":\n\n' - for track in possible_matches: - txt += f' "{track.title}" by {track.artist}' - txt += f' ({track.path})\n\n' + if len(possible_matches) > 5: + txt = "More than five tracks look similar to " + txt += f'"{title}" by "{artist} ({fname})":\n\n' + else: + txt += 'Similar to new track ' + txt += f'"{title}" by "{artist} ({fname})":\n\n' + for track in possible_matches: + txt += f' "{track.title}" by {track.artist}' + txt += f' ({track.path})\n\n' txt += "\n" # Check whether to proceed if there were potential matches txt += "Proceed with import?"