Close #5
This commit is contained in:
@ -82,7 +82,7 @@ function createConfig(): Config {
|
||||
|
||||
voicevox: {
|
||||
host: getOptionalEnv("VOICEVOX_HOST", "http://localhost:50021"),
|
||||
styleId: parseInt(getOptionalEnv("VOICEVOX_STYLE_ID", "0")),
|
||||
styleId: Number.parseInt(getOptionalEnv("VOICEVOX_STYLE_ID", "0")),
|
||||
},
|
||||
|
||||
podcast: {
|
||||
@ -100,7 +100,7 @@ function createConfig(): Config {
|
||||
},
|
||||
|
||||
admin: {
|
||||
port: parseInt(getOptionalEnv("ADMIN_PORT", "3001")),
|
||||
port: Number.parseInt(getOptionalEnv("ADMIN_PORT", "3001")),
|
||||
username: import.meta.env["ADMIN_USERNAME"],
|
||||
password: import.meta.env["ADMIN_PASSWORD"],
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Database } from "bun:sqlite";
|
||||
import fs from "fs";
|
||||
import crypto from "crypto";
|
||||
import fs from "fs";
|
||||
import { config } from "./config.js";
|
||||
|
||||
// Database integrity fixes function
|
||||
@ -275,7 +275,7 @@ export async function saveFeed(
|
||||
try {
|
||||
// Check if feed already exists
|
||||
const existingFeed = await getFeedByUrl(feed.url);
|
||||
|
||||
|
||||
if (existingFeed) {
|
||||
// Update existing feed
|
||||
const updateStmt = db.prepare(
|
||||
@ -293,7 +293,7 @@ export async function saveFeed(
|
||||
// Create new feed
|
||||
const id = crypto.randomUUID();
|
||||
const createdAt = new Date().toISOString();
|
||||
|
||||
|
||||
const insertStmt = db.prepare(
|
||||
"INSERT INTO feeds (id, url, title, description, last_updated, created_at, active) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||
);
|
||||
@ -879,7 +879,7 @@ export interface TTSQueueItem {
|
||||
export async function addToQueue(
|
||||
itemId: string,
|
||||
scriptText: string,
|
||||
retryCount: number = 0,
|
||||
retryCount = 0,
|
||||
): Promise<string> {
|
||||
const id = crypto.randomUUID();
|
||||
const createdAt = new Date().toISOString();
|
||||
@ -897,9 +897,7 @@ export async function addToQueue(
|
||||
}
|
||||
}
|
||||
|
||||
export async function getQueueItems(
|
||||
limit: number = 10,
|
||||
): Promise<TTSQueueItem[]> {
|
||||
export async function getQueueItems(limit = 10): Promise<TTSQueueItem[]> {
|
||||
try {
|
||||
const stmt = db.prepare(`
|
||||
SELECT * FROM tts_queue
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { OpenAI, ClientOptions } from "openai";
|
||||
import { type ClientOptions, OpenAI } from "openai";
|
||||
import { config, validateConfig } from "./config.js";
|
||||
|
||||
// Validate config on module load
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { promises as fs } from "fs";
|
||||
import { dirname } from "path";
|
||||
import { fetchEpisodesWithFeedInfo } from "./database.js";
|
||||
import path from "node:path";
|
||||
import fsSync from "node:fs";
|
||||
import path from "node:path";
|
||||
import { dirname } from "path";
|
||||
import { config } from "./config.js";
|
||||
import { fetchEpisodesWithFeedInfo } from "./database.js";
|
||||
|
||||
function escapeXml(text: string): string {
|
||||
return text
|
||||
|
@ -7,7 +7,7 @@ import { config } from "./config.js";
|
||||
* Split text into natural chunks for TTS processing
|
||||
* Aims for approximately 50 characters per chunk, breaking at natural points
|
||||
*/
|
||||
function splitTextIntoChunks(text: string, maxLength: number = 50): string[] {
|
||||
function splitTextIntoChunks(text: string, maxLength = 50): string[] {
|
||||
if (text.length <= maxLength) {
|
||||
return [text];
|
||||
}
|
||||
@ -242,7 +242,7 @@ async function concatenateAudioFiles(
|
||||
export async function generateTTSWithoutQueue(
|
||||
itemId: string,
|
||||
scriptText: string,
|
||||
retryCount: number = 0,
|
||||
retryCount = 0,
|
||||
): Promise<string> {
|
||||
if (!itemId || itemId.trim() === "") {
|
||||
throw new Error("Item ID is required for TTS generation");
|
||||
@ -337,7 +337,7 @@ export async function generateTTSWithoutQueue(
|
||||
export async function generateTTS(
|
||||
itemId: string,
|
||||
scriptText: string,
|
||||
retryCount: number = 0,
|
||||
retryCount = 0,
|
||||
): Promise<string> {
|
||||
const maxRetries = 2;
|
||||
|
||||
|
Reference in New Issue
Block a user