From: qydysky Date: Mon, 14 Aug 2023 22:30:49 +0000 (+0800) Subject: Fix 未生成xml #86 X-Git-Tag: v0.11.1~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=07d5857c4526f9bfb0987e3629912d34f5277538;p=bili_danmu%2F.git Fix 未生成xml #86 --- diff --git a/Reply/F.go b/Reply/F.go index 37a7faa..31324bb 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -1551,6 +1551,11 @@ func init() { if !file.New(v+"0.csv", 0, true).IsExist() { w.WriteHeader(http.StatusNotFound) return + } else if !file.New(v+"0.xml", 0, true).IsExist() { + type empty struct{} + if e := comp.Run(comp.Sign[empty](`SerF.player.ws`), context.Background(), &v); e != nil { + msglog.L(`E: `, e) + } } if s, closeF := PlayRecDanmu(v + "0.csv"); s == nil { diff --git a/Reply/F/comp.go b/Reply/F/comp.go index d288aa4..863d31c 100644 --- a/Reply/F/comp.go +++ b/Reply/F/comp.go @@ -9,10 +9,13 @@ import ( func init() { var linkMap = map[string][]string{ "github.com/qydysky/bili_danmu/Reply.startRecDanmu.stop": { - comp.Sign[danmuXml.Sign](), + comp.Sign[danmuXml.Sign](`toXml`), + }, + "github.com/qydysky/bili_danmu/Reply.SerF.player.ws": { + comp.Sign[danmuXml.Sign](`toXml`), }, "github.com/qydysky/bili_danmu/Reply.preparing": { - comp.Sign[liveOver.Sign](), + comp.Sign[liveOver.Sign](`sumup`), }, } if e := comp.Link(linkMap); e != nil { diff --git a/Reply/F/danmuXml/danmuXml.go b/Reply/F/danmuXml/danmuXml.go index a8ba0e4..3fb189a 100644 --- a/Reply/F/danmuXml/danmuXml.go +++ b/Reply/F/danmuXml/danmuXml.go @@ -13,10 +13,16 @@ import ( file "github.com/qydysky/part/file" ) -type Sign struct{} +type Sign struct { + // path: csv所在目录,末尾无 + toXml func(ctx context.Context, path *string) error +} func init() { - if e := comp.Put[string](comp.Sign[Sign](), toXml); e != nil { + sign := Sign{ + toXml: toXml, + } + if e := comp.Put[string](comp.Sign[Sign](`toXml`), sign.toXml); e != nil { panic(e) } } diff --git a/Reply/F/liveOver/liveOver.go b/Reply/F/liveOver/liveOver.go index 9d938ef..d579ced 100644 --- a/Reply/F/liveOver/liveOver.go +++ b/Reply/F/liveOver/liveOver.go @@ -9,10 +9,16 @@ import ( comp "github.com/qydysky/part/component" ) -type Sign struct{} +type Sign struct { + // 下播总结 + sumup func(ctx context.Context, ptr *c.Common) error +} func init() { - if e := comp.Put[c.Common](comp.Sign[Sign](), sumup); e != nil { + sign := Sign{ + sumup: sumup, + } + if e := comp.Put[c.Common](comp.Sign[Sign](`sumup`), sign.sumup); e != nil { panic(e) } }