diff --git a/setup.cfg b/setup.cfg index 3fcee7f..b05ae09 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = edge-tts -version = 4.0.7 +version = 4.0.8 author = rany author_email = ranygh@riseup.net description = Microsoft Edge's TTS diff --git a/src/edge_tts/communicate.py b/src/edge_tts/communicate.py index 819efe1..f0e80d7 100644 --- a/src/edge_tts/communicate.py +++ b/src/edge_tts/communicate.py @@ -261,6 +261,12 @@ class Communicate: # pylint: disable=too-few-public-methods if isinstance(messages, str): messages = [messages] + + # Variables for the loop + download = False + current_subtitle = "" + first_offset = None + last_offset = None async with aiohttp.ClientSession(trust_env=True) as session: async with session.ws_connect( f"{WSS_URL}&ConnectionId={connect_id()}", @@ -317,10 +323,6 @@ class Communicate: # pylint: disable=too-few-public-methods ) # Begin listening for the response. - download = False - current_subtitle = "" - first_offset = None - last_offset = None async for received in websocket: if received.type in ( aiohttp.WSMsgType.CLOSED,