Commit 224934754b

224934754b89e6de6260df29dc716311fa0341dd

parent: 88755d6f19

Unsigned

Wraient <wraient.911@gmail.com> · 2024-10-06 06:54 UTC

better anime selection

Layout: unified · split

curd.py +6
@@ -489,6 +489,8 @@ def select_anime(anime_list):
489 489
490 # Filter the anime list based on current input 490 # Filter the anime list based on current input
491 filtered_list = [anime for anime in anime_list.keys() if current_input.lower() in anime.lower()] 491 filtered_list = [anime for anime in anime_list.keys() if current_input.lower() in anime.lower()]
492 if filtered_list == []:
493 filtered_list = ['No anime found']
492 494
493 # Ensure selected index is within bounds after filtering 495 # Ensure selected index is within bounds after filtering
494 if selected_index >= len(filtered_list): 496 if selected_index >= len(filtered_list):
@@ -500,6 +502,10 @@ def select_anime(anime_list):
500 except Exception as e: 502 except Exception as e:
501 # If an exception occurs, print it after exiting curses 503 # If an exception occurs, print it after exiting curses
502 curses.endwin() 504 curses.endwin()
505 print("e:", e)
506 if e == 'No anime found':
507 print("No anime selected.")
508 exit(0)
503 print(f"An error occurred: {e}") 509 print(f"An error occurred: {e}")
504 finally: 510 finally:
505 # Ensure curses always exits cleanly 511 # Ensure curses always exits cleanly