fixed unicode bs

This commit is contained in:
Hellow 2023-04-06 17:45:15 +02:00
parent 3acfa417e8
commit 1f0ff801d8

View File

@ -41,13 +41,15 @@ EXIT_COMMANDS = {
"quit"
}
def print_cute_message():
message = get_random_message()
try:
print(message)
except UnicodeDecodeError:
except UnicodeEncodeError:
print((c for c in message if 0 < ord(c) < 127))
def cli(genre: str = None, download_all: bool = False):
def get_existing_genre() -> List[str]:
"""
@ -73,8 +75,7 @@ def cli(genre: str = None, download_all: bool = False):
def get_genre():
existing_genres = get_existing_genre()
for i, genre_option in enumerate(existing_genres):
print(f"{i+1:0>2}: {genre_option}")
print(f"{i + 1:0>2}: {genre_option}")
while True:
genre = input("Id or new genre: ")
@ -82,7 +83,7 @@ def cli(genre: str = None, download_all: bool = False):
if genre.isdigit():
genre_id = int(genre) - 1
if genre_id >= len(existing_genres):
print(f"No genre under the id {genre_id+1}.")
print(f"No genre under the id {genre_id + 1}.")
continue
return existing_genres[genre_id]