From 69a657910de8461a84a1963ed74988f02af99b3c Mon Sep 17 00:00:00 2001 From: sanj <67624670+iodrift@users.noreply.github.com> Date: Thu, 8 Aug 2024 21:25:24 -0700 Subject: [PATCH] Auto-update: Thu Aug 8 21:25:24 PDT 2024 --- sijapi/__init__.py | 54 +++++++++++++++++-------------------------- sijapi/routers/tts.py | 2 +- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/sijapi/__init__.py b/sijapi/__init__.py index 87ab67d..05c74a4 100644 --- a/sijapi/__init__.py +++ b/sijapi/__init__.py @@ -19,10 +19,14 @@ os.makedirs(LOGS_DIR, exist_ok=True) L = Logger("Central", LOGS_DIR) # API essentials -print("Loading API configuration...") API = APIConfig.load('api', 'secrets') Dir = DirConfig.load('dirs') +print(f"Data: {Dir.DATA}") +print(f"Config: {Dir.CONFIG}") +print(f"Logs: {Dir.LOGS}") +print(f"Podcast: {Dir.PODCAST}") + HOST = f"{API.BIND}:{API.PORT}" LOCAL_HOSTS = [ipaddress.ip_address(localhost.strip()) for localhost in os.getenv('LOCAL_HOSTS', '127.0.0.1').split(',')] + ['localhost'] SUBNET_BROADCAST = os.getenv("SUBNET_BROADCAST", '10.255.255.255') @@ -36,38 +40,22 @@ Scrape = Configuration.load('scrape', 'secrets', Dir) Serve = Configuration.load('serve', 'secrets', Dir) Tts = Configuration.load('tts', 'secrets', Dir) -print(f"Tts configuration loaded: {Tts}") -print(f"Tts.elevenlabs: {Tts.elevenlabs}") -print(f"Tts.elevenlabs.key: {Tts.elevenlabs.key}") -print(f"Tts.elevenlabs.voices: {Tts.elevenlabs.voices}") - -# Additional debug logging for Configuration class -print(f"Configuration.resolve_placeholders method: {Configuration.resolve_placeholders}") -print(f"Configuration.resolve_string_placeholders method: {Configuration.resolve_string_placeholders}") - -# Check if secrets are properly loaded -print(f"Secrets in Tts config: {[attr for attr in dir(Tts) if attr.isupper()]}") - -# Verify the structure of Tts.elevenlabs -print(f"Type of Tts.elevenlabs: {type(Tts.elevenlabs)}") -print(f"Attributes of Tts.elevenlabs: {dir(Tts.elevenlabs)}") - -# Check if the ElevenLabs API key is properly resolved -print(f"ElevenLabs API key (masked): {'*' * len(Tts.elevenlabs.key) if hasattr(Tts.elevenlabs, 'key') else 'Not found'}") - -# Verify the structure of Tts.elevenlabs.voices -print(f"Type of Tts.elevenlabs.voices: {type(Tts.elevenlabs.voices)}") -print(f"Attributes of Tts.elevenlabs.voices: {dir(Tts.elevenlabs.voices)}") - -# Check if the default voice is set -print(f"Default voice: {Tts.elevenlabs.default if hasattr(Tts.elevenlabs, 'default') else 'Not found'}") - -# Additional checks -print(f"Is 'get' method available on Tts.elevenlabs.voices? {'get' in dir(Tts.elevenlabs.voices)}") -print(f"Is 'values' method available on Tts.elevenlabs.voices? {'values' in dir(Tts.elevenlabs.voices)}") - -print("Initialization complete") - +# print(f"Tts configuration loaded: {Tts}") +# print(f"Tts.elevenlabs: {Tts.elevenlabs}") +# print(f"Tts.elevenlabs.key: {Tts.elevenlabs.key}") +# print(f"Tts.elevenlabs.voices: {Tts.elevenlabs.voices}") +# print(f"Configuration.resolve_placeholders method: {Configuration.resolve_placeholders}") +# print(f"Configuration.resolve_string_placeholders method: {Configuration.resolve_string_placeholders}") +# print(f"Secrets in Tts config: {[attr for attr in dir(Tts) if attr.isupper()]}") +# print(f"Type of Tts.elevenlabs: {type(Tts.elevenlabs)}") +# print(f"Attributes of Tts.elevenlabs: {dir(Tts.elevenlabs)}") +# print(f"ElevenLabs API key (masked): {'*' * len(Tts.elevenlabs.key) if hasattr(Tts.elevenlabs, 'key') else 'Not found'}") +# print(f"Type of Tts.elevenlabs.voices: {type(Tts.elevenlabs.voices)}") +# print(f"Attributes of Tts.elevenlabs.voices: {dir(Tts.elevenlabs.voices)}") +# print(f"Default voice: {Tts.elevenlabs.default if hasattr(Tts.elevenlabs, 'default') else 'Not found'}") +# print(f"Is 'get' method available on Tts.elevenlabs.voices? {'get' in dir(Tts.elevenlabs.voices)}") +# print(f"Is 'values' method available on Tts.elevenlabs.voices? {'values' in dir(Tts.elevenlabs.voices)}") +# print("Initialization complete") # Directories & general paths ROUTER_DIR = BASE_DIR / "routers" diff --git a/sijapi/routers/tts.py b/sijapi/routers/tts.py index e465446..1c718c6 100644 --- a/sijapi/routers/tts.py +++ b/sijapi/routers/tts.py @@ -244,7 +244,7 @@ async def generate_speech( warn(f"No file exists at {audio_file_path}") if podcast: - podcast_path = Path(Dir.PODCAST) / Path(audio_file_path).name + podcast_path = Dir.PODCAST / audio_file_path shutil.copy(audio_file_path, podcast_path) if podcast_path.exists():