aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2022-01-08 07:46:32 +0700
committerbenadha <benawiadha@gmail.com>2022-01-08 07:46:32 +0700
commit323ba80f262ba4ffa93664ec598a7954ae50dd71 (patch)
tree2edc9bc09ba7badb501fcd40edde05c57589bb08
parent280eba48ee382cfe41f0deab1a6898ce0e803351 (diff)
downloadepy-323ba80f262ba4ffa93664ec598a7954ae50dd71.tar.gz
Change history matching key from filepath to title author
-rwxr-xr-xepy.py14
1 files 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