From b4d6928d7387d2bbadbff4ef754605ac7c4916be Mon Sep 17 00:00:00 2001
From: yinbangzhong <zhongbangyin@126.com>
Date: 星期四, 20 六月 2024 14:51:47 +0800
Subject: [PATCH] add longaudio file explain

---
 service/process.go |    8 +++++++-
 conf/config.go     |    3 ++-
 conf/config.yaml   |    1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/conf/config.go b/conf/config.go
index f6d5ed9..b294032 100644
--- a/conf/config.go
+++ b/conf/config.go
@@ -43,7 +43,8 @@
 		PreLoadPath string // 鏈湴鏂囦欢棰勫姞杞借矾寰�
 	}
 	Analysis struct {
-		Url string // 鏈湴鏂囦欢瀛樺偍璺緞
+		Url     string // 鏈湴鏂囦欢瀛樺偍璺緞
+		LongUrl string // 鏈湴鏂囦欢棰勫姞杞借矾寰�
 	}
 )
 
diff --git a/conf/config.yaml b/conf/config.yaml
index 19ec80e..6caceda 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -21,3 +21,4 @@
   preLoadPath: preloads
 analysis:
   url: http://192.168.20.116:5000/recognition
+  longUrl: http://192.168.20.116:5000/recognition_long_audio
diff --git a/service/process.go b/service/process.go
index 4470791..922375f 100644
--- a/service/process.go
+++ b/service/process.go
@@ -105,7 +105,13 @@
 	}
 
 	go func() {
-		resp, err := AnalysisAudio(audio.FilePath, conf.AanlysisConf.Url)
+		var resp Response
+		sz := audio.Size / 1024 / 1024
+		if sz > 2 {
+			resp, err = AnalysisAudio(audio.FilePath, conf.AanlysisConf.LongUrl)
+		} else {
+			resp, err = AnalysisAudio(audio.FilePath, conf.AanlysisConf.Url)
+		}
 		if err != nil {
 			logx.Errorf("err when AnalysisAudio:%v", err)
 			_ = models.NewAudioSearch().SetID(audioId).UpdateByMap(map[string]interface{}{"audio_status": constvar.AudioStatusFailed})

--
Gitblit v1.8.0