完善背光控制,优先使用 xset 控制。完成浏览器展示
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"game-driver/internal/schema"
|
||||
"game-driver/leaf"
|
||||
"game-driver/pkg/audio"
|
||||
"game-driver/pkg/browser"
|
||||
"game-driver/pkg/relay"
|
||||
"game-driver/pkg/tts"
|
||||
"game-driver/pkg/utils"
|
||||
@@ -80,6 +81,12 @@ func WaitAction(c *leaf.Context) {
|
||||
videoAction(c, item, payload.TimeModel)
|
||||
}()
|
||||
case schema.WaitWeb:
|
||||
// 执行网页打开
|
||||
wait.Add(1)
|
||||
go func() {
|
||||
defer wait.Done()
|
||||
webAction(c, item, payload.TimeModel)
|
||||
}()
|
||||
default:
|
||||
zap.S().Infof("不支持的类型: %d\n", item.Type)
|
||||
}
|
||||
@@ -240,3 +247,29 @@ func videoAction(c *leaf.Context, item schema.WaitItemModel, root schema.TimeMod
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func webAction(c *leaf.Context, item schema.WaitItemModel, root schema.TimeModel) {
|
||||
if item.Start != 0 && time.Unix(item.Start, 0).Before(time.Unix(root.Start, 0)) {
|
||||
zap.S().Infoln("开始时间小于根任务开始时间")
|
||||
return
|
||||
}
|
||||
|
||||
if item.End != 0 {
|
||||
cancel := leaf.WithDeadline(c, time.Unix(item.End, 0))
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
select {
|
||||
case <-c.Done():
|
||||
case <-timerAction(item.Start):
|
||||
{
|
||||
zap.S().Infoln("打开待机网页")
|
||||
|
||||
// 控制背光
|
||||
utils.BlankOpen()
|
||||
defer utils.BlankClose()
|
||||
|
||||
browser.OpenApp(c, item.Data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user