fix: fbneo_roms_by_manucafcturer.py:find_games() error cuando la lista filtered_games está vacía y la función max() no tiene elementos para comparar.
This commit is contained in:
@@ -176,6 +176,10 @@ def find_games(file, search_string):
|
|||||||
game_manufacturer = game.getElementsByTagName("manufacturer")[0]
|
game_manufacturer = game.getElementsByTagName("manufacturer")[0]
|
||||||
filtered_games.append((description.firstChild.data, game.getAttribute('name'), game_manufacturer.firstChild.data))
|
filtered_games.append((description.firstChild.data, game.getAttribute('name'), game_manufacturer.firstChild.data))
|
||||||
|
|
||||||
|
if not filtered_games:
|
||||||
|
print(f"No se encontraron juegos que contengan '{search_string}'")
|
||||||
|
return
|
||||||
|
|
||||||
# Encuentra el ancho máximo para cada columna
|
# Encuentra el ancho máximo para cada columna
|
||||||
max_desc_length = max(len("Descripción"), max(len(row[0]) for row in filtered_games))
|
max_desc_length = max(len("Descripción"), max(len(row[0]) for row in filtered_games))
|
||||||
max_name_length = max(len("Nombre del archivo"), max(len(row[1] + '.zip') for row in filtered_games))
|
max_name_length = max(len("Nombre del archivo"), max(len(row[1] + '.zip') for row in filtered_games))
|
||||||
@@ -194,6 +198,7 @@ def find_games(file, search_string):
|
|||||||
# Imprime el pie de la tabla
|
# Imprime el pie de la tabla
|
||||||
print(f"{'='*(max_desc_length+max_name_length+max_manufacturer_length+10)}")
|
print(f"{'='*(max_desc_length+max_name_length+max_manufacturer_length+10)}")
|
||||||
|
|
||||||
|
|
||||||
def copy_games(file, args, all_games=False):
|
def copy_games(file, args, all_games=False):
|
||||||
"""Copia los juegos según los criterios especificados"""
|
"""Copia los juegos según los criterios especificados"""
|
||||||
if args.create_folder and not all_games:
|
if args.create_folder and not all_games:
|
||||||
|
|||||||
Reference in New Issue
Block a user