|
@@ -18,7 +18,6 @@ import (
|
|
|
"net"
|
|
|
"net/http"
|
|
|
"os"
|
|
|
- "os/exec"
|
|
|
"path"
|
|
|
"regexp"
|
|
|
"runtime"
|
|
@@ -509,39 +508,6 @@ func Sha1(data string) string {
|
|
|
return hex.EncodeToString(sha1.Sum([]byte("")))
|
|
|
}
|
|
|
|
|
|
-func GetVideoPlaySeconds(videoPath string) (playSeconds float64, err error) {
|
|
|
- cmd := `ffmpeg -i ` + videoPath + ` 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//`
|
|
|
- out, err := exec.Command("bash", "-c", cmd).Output()
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- outTimes := string(out)
|
|
|
- fmt.Println("outTimes:", outTimes)
|
|
|
- if outTimes != "" {
|
|
|
- timeArr := strings.Split(outTimes, ":")
|
|
|
- h := timeArr[0]
|
|
|
- m := timeArr[1]
|
|
|
- s := timeArr[2]
|
|
|
- hInt, err := strconv.Atoi(h)
|
|
|
- if err != nil {
|
|
|
- return playSeconds, err
|
|
|
- }
|
|
|
-
|
|
|
- mInt, err := strconv.Atoi(m)
|
|
|
- if err != nil {
|
|
|
- return playSeconds, err
|
|
|
- }
|
|
|
- s = strings.Trim(s, " ")
|
|
|
- s = strings.Trim(s, "\n")
|
|
|
- sInt, err := strconv.ParseFloat(s, 64)
|
|
|
- if err != nil {
|
|
|
- return playSeconds, err
|
|
|
- }
|
|
|
- playSeconds = float64(hInt)*3600 + float64(mInt)*60 + float64(sInt)
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
func GetMaxTradeCode(tradeCode string) (maxTradeCode string, err error) {
|
|
|
tradeCode = strings.Replace(tradeCode, "W", "", -1)
|
|
|
tradeCode = strings.Trim(tradeCode, " ")
|