Created
October 24, 2023 14:13
-
-
Save lewangdev/b28f42f2f672245419b9f52d7c525c17 to your computer and use it in GitHub Desktop.
Revisions
-
lewangdev created this gist
Oct 24, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ import asyncio from edge_tts import list_voices async def print_voices() -> None: """Print all available voices.""" voices = await list_voices() voices = sorted(voices, key=lambda voice: voice["ShortName"]) print("| Name | Gender | Language |") print("| :--- | :----- | :--------|") for idx, voice in enumerate(voices): if idx != 0: pass cols = None for key in voice.keys(): if key in ( "SuggestedCodec", "FriendlyName", "Status", "VoiceTag", "Name", "Locale", ): continue pretty_key_name = key if key != "ShortName" else "Name" if pretty_key_name == 'Name': cols = [] cols.append(voice[key]) if pretty_key_name == 'Gender': print(f"| {cols[0]} | {cols[1]} | {'-'.join(cols[0].split('-')[0:2])} |") if __name__ == "__main__": asyncio.run(print_voices())