mirror of
https://github.com/derrod/legendary.git
synced 2024-12-31 12:05:27 +00:00
[utils] Fix unhandled exception in alias generation
This commit is contained in:
parent
aafba86a94
commit
674793b808
|
@ -57,9 +57,13 @@ def generate_aliases(game_name, game_folder=None, split_words=True):
|
||||||
]
|
]
|
||||||
|
|
||||||
# single word abbreviation
|
# single word abbreviation
|
||||||
first_word = next(i for i in game_parts if i not in ('for', 'the', 'of'))
|
try:
|
||||||
if len(first_word) > 1:
|
first_word = next(i for i in game_parts if i not in ('for', 'the', 'of'))
|
||||||
_aliases.append(first_word)
|
if len(first_word) > 1:
|
||||||
|
_aliases.append(first_word)
|
||||||
|
except StopIteration:
|
||||||
|
pass
|
||||||
|
|
||||||
# remove subtitle from game
|
# remove subtitle from game
|
||||||
if ':' in game_name:
|
if ':' in game_name:
|
||||||
_aliases.extend(generate_aliases(game_name.partition(':')[0]))
|
_aliases.extend(generate_aliases(game_name.partition(':')[0]))
|
||||||
|
@ -90,5 +94,5 @@ def generate_aliases(game_name, game_folder=None, split_words=True):
|
||||||
_aliases.append(''.join(p[0] if p not in roman else p for p in new_game_parts))
|
_aliases.append(''.join(p[0] if p not in roman else p for p in new_game_parts))
|
||||||
_aliases.append(''.join(roman.get(p, p[0]) for p in new_game_parts))
|
_aliases.append(''.join(roman.get(p, p[0]) for p in new_game_parts))
|
||||||
|
|
||||||
# return sorted unqiues
|
# return sorted uniques
|
||||||
return sorted(set(_aliases))
|
return sorted(set(_aliases))
|
||||||
|
|
Loading…
Reference in a new issue