Skip to content

Commit

Permalink
fix(album-search): name_to_initials could have extra characters
Browse files Browse the repository at this point in the history
fixes #59
  • Loading branch information
rabelux committed Sep 14, 2022
1 parent 90ac2f7 commit d345713
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Contents/Code/search_tools.py
Expand Up @@ -87,17 +87,15 @@ def name_to_initials(self, input_name):
# and merged with dots.
# Example: 'Arthur Conan Doyle' -> 'A.C.Doyle'
name_parts = clear_contributor_text(input_name).split()
new_name = ""

# Check if prename and surname exist, otherwise exit
if len(name_parts) < 2:
return input_name

# traverse through prenames
for index, result in enumerate(name_parts):
s = result
# If prename already is an initial take it as is
new_name += (s[0] + '.') if len(s) > 2 and s[1] != '.' else s
new_name = ""
# Truncate prenames
for part in name_parts[:-1]:
new_name += part[0] + "." if part[1] != "." else part
# Add surname
new_name += name_parts[-1]

Expand Down

0 comments on commit d345713

Please sign in to comment.