Skip to content

Commit

Permalink
Console Settings Module
Browse files Browse the repository at this point in the history
* Console Settings Module
  • Loading branch information
cyberofficial committed Aug 1, 2023
1 parent 5f3754b commit e7a0ffd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
13 changes: 13 additions & 0 deletions modules/console_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys
import ctypes


def set_window_title(detected_language, confidence):
title = f"Model: {model} - {detected_language} [{confidence:.2f}%]"

if sys.platform == "win32":
ctypes.windll.kernel32.SetConsoleTitleW(title)
else:
sys.stdout.write(f"\x1b]2;{title}\x1b\x5c")
sys.stdout.flush()

11 changes: 1 addition & 10 deletions transcribe_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
from modules.version_checker import check_for_updates
from modules.model_downloader import fine_tune_model_dl, fine_tune_model_dl_compressed
from modules.discord import send_to_discord_webhook
from modules.console_settings import set_window_title

# Code is semi documented, but if you have any questions, feel free to ask in the Discussions tab.

Expand All @@ -108,16 +109,6 @@ def record_callback(_, audio:sr.AudioData) -> None:
data = audio.get_raw_data()
data_queue.put(data)

def set_window_title(detected_language, confidence):
title = f"Model: {model} - {detected_language} [{confidence:.2f}%]"

if sys.platform == "win32":
ctypes.windll.kernel32.SetConsoleTitleW(title)
else:
sys.stdout.write(f"\x1b]2;{title}\x1b\x5c")
sys.stdout.flush()


def is_input_device(device_index):
pa = pyaudio.PyAudio()
device_info = pa.get_device_info_by_index(device_index)
Expand Down

0 comments on commit e7a0ffd

Please sign in to comment.