Skip to content

Commit b4a75cb

Browse files
committed
TTS
1 parent 1080b52 commit b4a75cb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from config import get_config
1515
from services.background_tasks import init_background_tasks
1616
from services.database import init_database
17+
from services.path_utils import expand_path
1718

1819
from routes.stream import router as stream_router, init_stream_globals
1920
from routes.queue import router as queue_router
@@ -83,14 +84,14 @@ def filter(self, record: logging.LogRecord) -> bool:
8384
init_database()
8485

8586
# Audio download directory is always needed
86-
os.makedirs(config.temp_audio_dir, exist_ok=True)
87+
expand_path(config.temp_audio_dir).mkdir(parents=True, exist_ok=True)
8788

8889
# Create TTS audio directory if TTS is enabled
8990
if config.tts_enabled:
9091
logger.info(
9192
f"TTS enabled - creating audio directory: {config.weekly_summary_audio_dir}"
9293
)
93-
os.makedirs(config.weekly_summary_audio_dir, exist_ok=True)
94+
expand_path(config.weekly_summary_audio_dir).mkdir(parents=True, exist_ok=True)
9495

9596
# Initialize background tasks if transcription is enabled
9697
if config.transcription_enabled:

services/streaming.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import subprocess
1010

1111
from services.cache import get_audio_cache
12-
from services.path_utils import expand_path
12+
from services.path_utils import expand_path, expand_path_str
1313
from config import get_config
1414

1515
logger = logging.getLogger(__name__)
@@ -63,7 +63,7 @@ def start_youtube_download(youtube_video_id: str):
6363
# -o uses the base path WITHOUT extension — yt-dlp appends .mp3 via --audio-format.
6464
# Passing -o with .mp3 extension causes yt-dlp to create path.mp3.mp3.
6565
# --extract-audio handles the ffmpeg conversion internally.
66-
base_path = os.path.join(config.temp_audio_dir, youtube_video_id)
66+
base_path = expand_path_str(os.path.join(config.temp_audio_dir, youtube_video_id))
6767
yt_cmd = [
6868
"/usr/local/bin/yt-dlp",
6969
"-f",

services/trilium.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from config import get_config
1010
from services.database import get_video_title_from_history
1111
from services.api_clients import get_httpx_client
12+
from services.path_utils import expand_path_str
1213

1314
logger = logging.getLogger(__name__)
1415

@@ -410,7 +411,7 @@ def attach_audio_to_note(
410411
logger.info(f"Created file note: {file_note_id}")
411412

412413
# Step 2: Upload the file content using a direct HTTP client
413-
with open(audio_file_path, "rb") as f:
414+
with open(expand_path_str(audio_file_path), "rb") as f:
414415
audio_data = f.read()
415416

416417
file_size_mb = len(audio_data) / (1024 * 1024)

0 commit comments

Comments
 (0)