fix: auto create temp dir

This commit is contained in:
linyuchen 2024-03-21 13:03:20 +08:00
parent ebca6a07c5
commit 6a8c5ec24a
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,7 @@
export interface OB11Config {
httpPort: number
httpHosts: string[]
httpSecret?: string
wsPort: number
wsHosts: string[]
enableHttp?: boolean

View File

@ -116,7 +116,6 @@ export async function encodeSilk(filePath: string) {
// }
try {
const fileName = path.basename(filePath);
const pttPath = path.join(DATA_DIR, uuidv4());
if (getFileHeader(filePath) !== "02232153494c4b") {
log(`语音文件${filePath}需要转换成silk`)
@ -151,7 +150,7 @@ export async function encodeSilk(filePath: string) {
fs.writeFileSync(pttPath, silk.data);
fs.unlink(wavPath, (err) => {
});
const duration = verifyDuration(silk.duration, await guessDuration(filePath))
const duration = verifyDuration(silk.duration / 1000, await guessDuration(filePath))
return {
converted: true,
path: pttPath,