"""
Jimlet Text-to-Speech Converter
"""

__copyright__ = "© 2026 Indextаr LLC"
__version__ = "1.1"

import os
import sys
from pathlib import Path
import logging
from platformdirs import user_config_dir
from .set_loggers import set_screen_logger, set_file_logger
from . import config as conf

if conf.DISTR_TYPE == "pyfolder":
    os.environ["HF_HUB_DISABLE_PROGRESS_BARS"] = "1"
    os.environ["HF_HUB_DISABLE_XET"] = "1"

def _get_data_path() -> Path:
    if conf.DISTR_TYPE == "pyfolder":
        p = Path(sys.executable).parent / "data"
    else:
        p = Path(user_config_dir(conf.APP_NAME, conf.APP_AUTHOR))

    p.mkdir(parents=True, exist_ok=True)
    return p

data_path = _get_data_path()

logger = logging.getLogger(__name__)

if conf.LOG_TO == "screen":
    set_screen_logger(logger)
else:
    log_fname = (data_path / "jimlet.log").absolute()
    set_file_logger(logger, log_fname, conf.LOG_LEVEL)


def _get_proj_path():

    if conf.DISTR_TYPE == "pyfolder":
        return Path(sys.executable).parent

    return module_path.parent

module_path = Path(__file__).parent
proj_path = _get_proj_path()
assets_path = module_path / "assets"

from .stats import stats

