66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
package main
|
||
|
||
import (
|
||
"embed"
|
||
"os"
|
||
|
||
"github.com/wailsapp/wails/v3/pkg/application"
|
||
"videoconcat/services"
|
||
)
|
||
|
||
//go:embed assets
|
||
var assets embed.FS
|
||
|
||
func main() {
|
||
// 检测开发模式并设置日志级别
|
||
if os.Getenv("DEV") == "true" {
|
||
services.SetLogLevel("DEBUG")
|
||
services.LogInfo("=== 开发模式启动 ===")
|
||
services.LogDebug("详细日志已启用")
|
||
}
|
||
|
||
// 创建服务
|
||
services.LogDebug("开始创建服务...")
|
||
videoService := services.NewVideoService()
|
||
extractService := services.NewExtractService()
|
||
authService := services.NewAuthService()
|
||
fileService := services.NewFileService()
|
||
services.LogDebug("所有服务创建完成")
|
||
|
||
services.LogDebug("创建 Wails 应用...")
|
||
app := application.New(application.Options{
|
||
Name: "VideoConcat",
|
||
Description: "视频拼接工具",
|
||
Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)},
|
||
Services: []application.Service{
|
||
application.NewService(videoService),
|
||
application.NewService(extractService),
|
||
application.NewService(authService),
|
||
application.NewService(fileService),
|
||
},
|
||
Mac: application.MacOptions{
|
||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||
},
|
||
})
|
||
services.LogDebug("Wails 应用创建完成")
|
||
|
||
// 创建窗口
|
||
services.LogDebug("创建应用窗口...")
|
||
window := app.Window.NewWithOptions(application.WebviewWindowOptions{
|
||
Title: "视频拼接工具",
|
||
Width: 1100,
|
||
Height: 800,
|
||
MinWidth: 800,
|
||
MinHeight: 600,
|
||
})
|
||
|
||
window.SetURL("index.html")
|
||
services.LogInfo("应用窗口已创建,URL: index.html")
|
||
|
||
services.LogInfo("=== 应用启动完成,开始运行 ===")
|
||
if err := app.Run(); err != nil {
|
||
services.LogErrorf("应用运行错误: %v", err)
|
||
panic(err)
|
||
}
|
||
}
|