diff --git a/gui.py b/gui.py index 2c77243..59aa5f8 100644 --- a/gui.py +++ b/gui.py @@ -70,9 +70,12 @@ def draw_multi_select(stdscr, messages: list, center_row): ) -def multi_select(stdscr, options, title, subtitle=""): +def multi_select(stdscr, options, title, subtitle="", checked=None): # curses.curs_set(0) # 隐藏光标 - checked = [False] * len(options) + if checked is None: + checked = [False] * len(options) + else: + checked = [bool(c) for c in checked] current_row = 0 while True: draw_menu(stdscr, options, checked, title, subtitle, current_row) @@ -157,6 +160,7 @@ def config(stdscr): ["下载蓝牙音频"], "选择是否下载教室蓝牙话筒的音频(如果有的话):", "若教师未使用教室蓝牙话筒则该音频无声音", + checked=[True], ) stdscr.clear() diff --git a/utils.py b/utils.py index 51866a2..17d5253 100644 --- a/utils.py +++ b/utils.py @@ -95,7 +95,11 @@ def get_audio_url(video_id): def download_audio(url, path, name): token = getToken() url = add_signature_for_url(url, token, *getSignature()) - print(url) - res = requests.get(url, headers=headers) + _headers = headers.copy() + _headers["Host"] = "cvideo.yanhekt.cn" + res = requests.get(url, headers=_headers) + while res.status_code != 200: + time.sleep(0.1) + res = requests.get(url, headers=_headers) with open(f"{path}/{name}.aac", "wb") as f: f.write(res.content)