|
@@ -6,7 +6,6 @@ import (
|
|
"eta/eta_api/services"
|
|
"eta/eta_api/services"
|
|
"eta/eta_api/utils"
|
|
"eta/eta_api/utils"
|
|
"fmt"
|
|
"fmt"
|
|
- "github.com/kgiannakakis/mp3duration/src/mp3duration"
|
|
|
|
"github.com/rdlucklib/rdluck_tools/http"
|
|
"github.com/rdlucklib/rdluck_tools/http"
|
|
"os"
|
|
"os"
|
|
"path"
|
|
"path"
|
|
@@ -116,15 +115,19 @@ func (this *VoiceController) Upload() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- var playSeconds float64
|
|
|
|
- playSeconds, err = mp3duration.Calculate(fpath)
|
|
|
|
- if playSeconds <= 0 {
|
|
|
|
- playSeconds, err = utils.GetVideoPlaySeconds(fpath)
|
|
|
|
- if err != nil {
|
|
|
|
- br.Msg = "获取音频时间失败"
|
|
|
|
- br.ErrMsg = "获取音频时间失败,Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ //var playSeconds float64
|
|
|
|
+ //playSeconds, err = mp3duration.Calculate(fpath)
|
|
|
|
+ //if playSeconds <= 0 {
|
|
|
|
+ // playSeconds, err = utils.GetVideoPlaySeconds(fpath)
|
|
|
|
+ // if err != nil {
|
|
|
|
+ // br.Msg = "获取音频时间失败"
|
|
|
|
+ // br.ErrMsg = "获取音频时间失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ playSecondsStr, err := utils.GetDuration(fpath) //mp3duration.Calculate(fPath)
|
|
|
|
+ if err != nil {
|
|
|
|
+ utils.FileLog.Info("获取音频时间失败,Err:" + err.Error())
|
|
}
|
|
}
|
|
|
|
|
|
fileBody, err := os.ReadFile(fpath)
|
|
fileBody, err := os.ReadFile(fpath)
|
|
@@ -146,7 +149,7 @@ func (this *VoiceController) Upload() {
|
|
|
|
|
|
reportInfo.VideoUrl = resourceUrl
|
|
reportInfo.VideoUrl = resourceUrl
|
|
reportInfo.VideoName = videoName
|
|
reportInfo.VideoName = videoName
|
|
- reportInfo.VideoPlaySeconds = fmt.Sprint(playSeconds)
|
|
|
|
|
|
+ reportInfo.VideoPlaySeconds = playSecondsStr
|
|
reportInfo.VideoSize = sizeStr
|
|
reportInfo.VideoSize = sizeStr
|
|
reportInfo.LastModifyAdminId = this.SysUser.AdminId
|
|
reportInfo.LastModifyAdminId = this.SysUser.AdminId
|
|
reportInfo.LastModifyAdminName = this.SysUser.RealName
|
|
reportInfo.LastModifyAdminName = this.SysUser.RealName
|