Skip to content

Commit

Permalink
v0.07.6 - logging interval in config.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingFathead committed Apr 1, 2024
1 parent 7394523 commit ac3394e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/transcription_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
# asyncio debugging on
asyncio.get_event_loop().set_debug(True)

# set the config base dir just once at the top of your script
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# get the general settings
def get_general_settings():
config = configparser.ConfigParser()
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
config = configparser.ConfigParser()
config_path = os.path.join(base_dir, 'config', 'config.ini')
config.read(config_path)
allow_all_sites = config.getboolean('GeneralSettings', 'AllowAllSites', fallback=False)
Expand All @@ -68,25 +70,22 @@ def get_logging_settings():
# get whisper model
def get_whisper_model():
config = configparser.ConfigParser()
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
config_path = os.path.join(base_dir, 'config', 'config.ini')
config.read(config_path)
model = config.get('WhisperSettings', 'Model', fallback='base')
return model

# get transcription settings
def get_transcription_settings():
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
config = configparser.ConfigParser()
config_path = os.path.join(base_dir, 'config', 'config.ini')

if not os.path.exists(config_path):
logger.error("Error: config.ini not found at the expected path.")
sys.exit(1)

config = configparser.ConfigParser()
config.read(config_path)

# Ensure 'TranscriptionSettings' section exists
if 'TranscriptionSettings' not in config:
logger.error("TranscriptionSettings section missing in config.ini")
sys.exit(1)
Expand Down

0 comments on commit ac3394e

Please sign in to comment.