From 07d5857c4526f9bfb0987e3629912d34f5277538 Mon Sep 17 00:00:00 2001 From: qydysky Date: Tue, 15 Aug 2023 06:30:49 +0800 Subject: [PATCH] =?utf8?q?Fix=20=20=E6=9C=AA=E7=94=9F=E6=88=90xml=20#86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/F.go | 5 +++++ Reply/F/comp.go | 7 +++++-- Reply/F/danmuXml/danmuXml.go | 10 ++++++++-- Reply/F/liveOver/liveOver.go | 10 ++++++++-- 4 files changed, 26 insertions(+), 6 deletions(-) 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) } } -- 2.39.2