Bläddra i källkod

add longaudio file explain

yinbangzhong 2 år sedan
förälder
incheckning
b4d6928d73
3 ändrade filer med 10 tillägg och 2 borttagningar
  1. 2 1
      conf/config.go
  2. 1 0
      conf/config.yaml
  3. 7 1
      service/process.go

+ 2 - 1
conf/config.go

@@ -43,7 +43,8 @@ type (
 		PreLoadPath string // 本地文件预加载路径
 	}
 	Analysis struct {
-		Url string // 本地文件存储路径
+		Url     string // 本地文件存储路径
+		LongUrl string // 本地文件预加载路径
 	}
 )
 

+ 1 - 0
conf/config.yaml

@@ -21,3 +21,4 @@ local:
   preLoadPath: preloads
 analysis:
   url: http://192.168.20.116:5000/recognition
+  longUrl: http://192.168.20.116:5000/recognition_long_audio

+ 7 - 1
service/process.go

@@ -105,7 +105,13 @@ func Process(audioId uint) (err error) {
 	}
 
 	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})