Auto-update: Thu Aug 8 16:30:18 PDT 2024

This commit is contained in:
sanj 2024-08-08 16:30:18 -07:00
parent 551295549e
commit ba87576f83
2 changed files with 9 additions and 8 deletions

View file

@ -24,12 +24,12 @@ 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'] 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') SUBNET_BROADCAST = os.getenv("SUBNET_BROADCAST", '10.255.255.255')
MAX_CPU_CORES = min(int(os.getenv("MAX_CPU_CORES", int(multiprocessing.cpu_count()/2))), multiprocessing.cpu_count()) MAX_CPU_CORES = min(int(os.getenv("MAX_CPU_CORES", int(multiprocessing.cpu_count()/2))), multiprocessing.cpu_count())
IMG = Configuration.load('img', 'secrets') IMG = Configuration.load('img', 'secrets', Dir)
News = Configuration.load('news', 'secrets') News = Configuration.load('news', 'secrets', Dir)
Archivist = Configuration.load('archivist') Archivist = Configuration.load('archivist', 'secrets', Dir)
Scrape = Configuration.load('scrape', 'secrets', Dir) Scrape = Configuration.load('scrape', 'secrets', Dir)
Serve = Configuration.load('serve') Serve = Configuration.load('serve', 'secrets', Dir)
Tts = Configuration.load('tts') Tts = Configuration.load('tts', 'secrets', Dir)
# Directories & general paths # Directories & general paths
ROUTER_DIR = BASE_DIR / "routers" ROUTER_DIR = BASE_DIR / "routers"

View file

@ -26,7 +26,7 @@ import tempfile
import random import random
import re import re
import os import os
from sijapi import L, Dir, Tts, DEFAULT_VOICE, TTS_SEGMENTS_DIR, VOICE_DIR, PODCAST_DIR, TTS_OUTPUT_DIR, ELEVENLABS_API_KEY from sijapi import L, API, Dir, Tts, TTS_SEGMENTS_DIR, VOICE_DIR, TTS_OUTPUT_DIR, ELEVENLABS_API_KEY
from sijapi.utilities import sanitize_filename from sijapi.utilities import sanitize_filename
### INITIALIZATIONS ### ### INITIALIZATIONS ###
@ -274,6 +274,7 @@ async def get_voice_file_path(voice: str = None, voice_file: UploadFile = None)
debug(f"Looking for voice: {voice}") debug(f"Looking for voice: {voice}")
selected_voice = await select_voice(voice) selected_voice = await select_voice(voice)
return selected_voice return selected_voice
elif voice_file and isinstance(voice_file, UploadFile): elif voice_file and isinstance(voice_file, UploadFile):
VOICE_DIR.mkdir(exist_ok=True) VOICE_DIR.mkdir(exist_ok=True)
@ -300,8 +301,8 @@ async def get_voice_file_path(voice: str = None, voice_file: UploadFile = None)
return str(new_file) return str(new_file)
else: else:
debug(f"{dt_datetime.now().strftime('%Y%m%d%H%M%S')}: No voice specified or file provided, using default voice: {DEFAULT_VOICE}") debug(f"No voice specified or file provided, using default voice: {Tts.xtts.default}")
selected_voice = await select_voice(DEFAULT_VOICE) selected_voice = await select_voice(Tts.xtts.default)
return selected_voice return selected_voice