From 8122a68b78a92af8f550c1cff9bdcdef7c5663e6 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sun, 5 Jan 2025 00:43:38 +0800 Subject: [PATCH] =?utf8?q?Fix=20=E5=BD=95=E6=92=AD=E6=96=87=E4=BB=B6?= =?utf8?q?=E5=A4=B9=E4=B8=8B=E5=AD=90=E7=9B=AE=E5=BD=95=E5=AF=BC=E8=87=B4?= =?utf8?q?=E5=9B=9E=E6=94=BE=E7=9B=AE=E5=BD=95=E9=94=99=E8=AF=AF=20(#142)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- Reply/F.go | 4 +++- Reply/F/videoInfo/videoInfo.go | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 040ad65..c5d55ee 100644 --- a/README.md +++ b/README.md @@ -649,7 +649,7 @@ ass编码GB18030支持中文 添加配置项`弹幕回放_隐藏发送人`(>v0.14.19),为`true`时,回放弹幕文件类型记录(ass,xml,csv...)不记录发送人,当前直播的即时回放不显示发送人,但不影响`保存弹幕至db`等日志类型记录。由于回放依赖于csv类型文件,故回放历史录播亦不显示发送人。默认为`false`。 -当`直播流保存天数`大于1时(默认4),当t日有1录播时,会尝试删除t-n日及之前的1or2个最早的录播。目录下有.keep文件将忽略(v0.12.7+)。 +当`直播流保存天数`大于1时(默认4),当t日有1录播时,会尝试删除t-n日及之前的1or2个最早的录播。目录下有.keep文件或目录名不以`yyyy_mm_dd-hh24_mi_ss`开头将忽略(v0.12.7+)。 #### 直播流回放Web服务 启动Web流服务,为下载的直播流提供局域网内的流服务,提供flv、hls/mp4格式流。 diff --git a/Reply/F.go b/Reply/F.go index 2773fe0..254a1cc 100644 --- a/Reply/F.go +++ b/Reply/F.go @@ -937,7 +937,9 @@ func init() { size, _ := strconv.Atoi(r.URL.Query().Get("size")) for i, n := skip, len(fs); i < n && (size == 0 || len(filePaths) < size); i++ { if filePath, e := videoInfo.Get.Run(context.Background(), fs[i]); e != nil { - flog.L(`W: `, fs[i], e) + if !errors.Is(e, os.ErrNotExist) { + flog.L(`W: `, fs[i], e) + } continue } else { if t, e := time.Parse("2006_01_02-15_04_05", filePath.StartT); e == nil { diff --git a/Reply/F/videoInfo/videoInfo.go b/Reply/F/videoInfo/videoInfo.go index 18d81e6..4c3838c 100644 --- a/Reply/F/videoInfo/videoInfo.go +++ b/Reply/F/videoInfo/videoInfo.go @@ -83,23 +83,23 @@ func get(ctx context.Context, savepath string) (*Paf, error) { defer dirf.Close() if dirf.IsDir() { // 从文件夹获取信息 - { - dirfName := path.Base(dirf.File().Name()) - if len(dirfName) > 20 { - d = Paf{Name: dirfName[20:], StartT: dirfName[:19], Path: dirfName} - } - mp4f := file.New(savepath+string(os.PathSeparator)+"0.mp4", 0, true) - if mp4f.IsExist() { - d.Format = "mp4" - } else { - d.Format = "flv" - } - } + // { + // dirfName := path.Base(dirf.File().Name()) + // if len(dirfName) > 20 { + // d = Paf{Name: dirfName[20:], StartT: dirfName[:19], Path: dirfName} + // } + // mp4f := file.New(savepath+string(os.PathSeparator)+"0.mp4", 0, true) + // if mp4f.IsExist() { + // d.Format = "mp4" + // } else { + // d.Format = "flv" + // } + // } // 从0.json获取信息 { json0 := file.New(savepath+string(os.PathSeparator)+"0.json", 0, true) if !json0.IsExist() { - return &d, nil + return &d, os.ErrNotExist } defer json0.Close() if data, e := json0.ReadAll(1<<8, 1<<16); e != nil && !errors.Is(e, io.EOF) { -- 2.39.2