| | |
| | | package service |
| | | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "basic.com/fileServer/WeedFSClient.git" |
| | | "basic.com/valib/capture.git" |
| | | "errors" |
| | | "path/filepath" |
| | | "strconv" |
| | | "webserver/extend/config" |
| | | "webserver/extend/esutil" |
| | | |
| | | "basic.com/dbapi.git" |
| | | "basic.com/valib/capture.git" |
| | | ) |
| | | /*以下属于旧版本地摄像机获取截图(国标摄像机底图无法刷新) |
| | | func PostFormBufferData(uri string, filepath string, fileName string) (maps map[string]interface{}, err0 error) { |
| | |
| | | b,err := capture.Capture("./runtime/libcffmpeg.so",m,camera.Rtsp,capture.JPEGFileExt,1280,720,10) |
| | | if err == nil{ |
| | | var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit" |
| | | resp, err := esutil.PostFormBufferData(weedfsUri, camera.Name+".jpg", "file", b) |
| | | weedFilePath, err := WeedFSClient.UploadFile(weedfsUri, camera.Name+".jpg", b) |
| | | if err != nil { |
| | | return "",err |
| | | } else { |
| | | fileurl := resp["fileUrl"].(string) // 文件路径 |
| | | filename := filepath.Base(fileurl) |
| | | ok := cameraApi.UpdateSnapshotUrl(cid, filename) |
| | | ok := cameraApi.UpdateSnapshotUrl(cid, weedFilePath) |
| | | if !ok { |
| | | return "", errors.New("update camera's snapshot fail") |
| | | } |
| | | return filename, nil |
| | | return weedFilePath, nil |
| | | } |
| | | }else{ |
| | | return "",err |