mirror of
https://github.com/YILS-LIN/short-video-factory.git
synced 2025-11-25 11:29:34 +08:00
解决 BGM 文件夹存在非 mp3 文件时报错问题
This commit is contained in:
@@ -66,9 +66,9 @@ const handleRenderVideo = async () => {
|
|||||||
let randomBgm: ListFilesFromFolderRecord | undefined = undefined
|
let randomBgm: ListFilesFromFolderRecord | undefined = undefined
|
||||||
if (appStore.renderConfig.bgmPath) {
|
if (appStore.renderConfig.bgmPath) {
|
||||||
try {
|
try {
|
||||||
const bgmList = await window.electron.listFilesFromFolder({
|
const bgmList = (await window.electron.listFilesFromFolder({
|
||||||
folderPath: appStore.renderConfig.bgmPath.replace(/\\/g, '/'),
|
folderPath: appStore.renderConfig.bgmPath.replace(/\\/g, '/'),
|
||||||
})
|
})).filter((asset) => asset.name.endsWith('.mp3'))
|
||||||
if (bgmList.length > 0) {
|
if (bgmList.length > 0) {
|
||||||
randomBgm = random.choice(bgmList)
|
randomBgm = random.choice(bgmList)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user