fix unbound local variable python error

This commit is contained in:
rany 2022-03-11 17:46:44 +02:00
parent 871f1938e6
commit 7d03764943
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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,