From 323ba80f262ba4ffa93664ec598a7954ae50dd71 Mon Sep 17 00:00:00 2001 From: benadha Date: Sat, 8 Jan 2022 07:46:32 +0700 Subject: Change history matching key from filepath to title author --- epy.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/epy.py b/epy.py index 261bd6b..9f3f99d 100755 --- a/epy.py +++ b/epy.py @@ -3642,24 +3642,24 @@ def parse_cli_args() -> str: if (not candidate[0]) or candidate[1]: matching_value = 0 for item in library: - file = item.filepath - this_file_match_value = sum( + tomatch = f"{item.title} - {item.author}" # item.filepath + this_item_match_value = sum( [ i.size for i in SM( - None, file.lower(), " ".join(args).lower() + None, tomatch.lower(), " ".join(args).lower() ).get_matching_blocks() ] ) - if this_file_match_value >= matching_value: - matching_value = this_file_match_value - candidate = (file, None) + if this_item_match_value >= matching_value: + matching_value = this_item_match_value + candidate = (item.filepath, None) if matching_value == 0: candidate = (None, "\nERROR: No matching file found in history.") if (not candidate[0]) or candidate[1] or "-r" in args: - print("Reading history:") + print("Reading History:") # dig = len(str(len(STATE["States"].keys()) + 1)) dig = len(str(len(library) + 1)) tcols = termc - dig - 2 -- cgit