From 104930c4137ca89cf382c409cc565e847287ba01 Mon Sep 17 00:00:00 2001
From: Jerry Yan <792602257@qq.com>
Date: Sun, 13 Apr 2025 16:07:29 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96stopTime=E4=B8=BA=E7=A9=BA?=
 =?UTF-8?q?=E6=97=B6=E9=80=BB=E8=BE=91=E7=88=86=E7=82=B8=E7=9A=84=E9=97=AE?=
 =?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 fs/local_adapter.go | 5 ++++-
 fs/s3_adapter.go    | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/fs/local_adapter.go b/fs/local_adapter.go
index 90296e1..dbef8af 100644
--- a/fs/local_adapter.go
+++ b/fs/local_adapter.go
@@ -51,7 +51,10 @@ func (l *LocalAdapter) GetFileList(ctx context.Context, dirPath string, relDt ti
 		if err != nil {
 			continue
 		}
-		if startTime.Equal(stopTime) || stopTime.IsZero() {
+		if stopTime.IsZero() {
+			stopTime = startTime
+		}
+		if startTime.Equal(stopTime) {
 			// 如果文件名没有时间戳,则认为该文件是未录制完成的
 			// 尝试读取一下视频信息
 			duration, err := util.GetVideoDuration(subCtx, path.Join(l.StorageConfig.Path, dirPath, file.Name()))
diff --git a/fs/s3_adapter.go b/fs/s3_adapter.go
index aac52ce..0281c1f 100644
--- a/fs/s3_adapter.go
+++ b/fs/s3_adapter.go
@@ -91,7 +91,10 @@ func (s *S3Adapter) GetFileList(ctx context.Context, dirPath string, relDt time.
 			if err != nil {
 				continue
 			}
-			if startTime.Equal(stopTime) || stopTime.IsZero() {
+			if stopTime.IsZero() {
+				stopTime = startTime
+			}
+			if startTime.Equal(stopTime) {
 				stopTime = stopTime.Add(time.Second * time.Duration(config.Config.Record.Duration))
 			}
 			presignClient := s3.NewPresignClient(client)