mirror of
https://github.com/Monibuca/plugin-record.git
synced 2025-10-05 08:46:59 +08:00
Eanfs v4 (#41)
* [feature] 支持录制完成后上传到Minio * change module id * Update mod name * reset go.mod * Update for minio uploading * Update for log * [feature] support all Recorder * Update * Merge branch 'v4' into githubv4 * v4: git commit for minio * fix error * Update * Update * Update for support max Duration * Update v4.6.5 * Update for chang Config name * [refactor] update for recording duration * Update for remove orgion file * Update mod * Update * fix: close mp4 record error * Update readme * Fix file not upload Successfully * feat(recording): 支持录制检查回调 * feat:增加数据库录制检查 * Update 录制文件没有写入结束标志 * 更新依赖包 * fix(record): 自动删除的录像文件。 * Update for sqllite to db error
This commit is contained in:
17
restful.go
17
restful.go
@@ -53,6 +53,7 @@ func (conf *RecordConfig) API_start(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
t := query.Get("type")
|
||||
duration := query.Get("duration")
|
||||
var id string
|
||||
var err error
|
||||
var irecorder IRecorder
|
||||
@@ -94,6 +95,13 @@ func (conf *RecordConfig) API_start(w http.ResponseWriter, r *http.Request) {
|
||||
util.ReturnError(util.APIErrorInternal, err.Error(), w, r)
|
||||
return
|
||||
}
|
||||
|
||||
// 设置录制时长限制
|
||||
if duration != "" {
|
||||
if d, err := time.ParseDuration(duration); err == nil {
|
||||
recorder.Duration = d
|
||||
}
|
||||
}
|
||||
util.ReturnError(util.APIErrorNone, id, w, r)
|
||||
}
|
||||
|
||||
@@ -108,7 +116,8 @@ func (conf *RecordConfig) API_list_recording(w http.ResponseWriter, r *http.Requ
|
||||
}
|
||||
|
||||
func (conf *RecordConfig) API_stop(w http.ResponseWriter, r *http.Request) {
|
||||
if recorder, ok := conf.recordings.Load(r.URL.Query().Get("id")); ok {
|
||||
id := r.URL.Query().Get("id")
|
||||
if recorder, ok := conf.recordings.Load(id); ok {
|
||||
recorder.(ISubscriber).Stop(zap.String("reason", "api"))
|
||||
util.ReturnOK(w, r)
|
||||
return
|
||||
@@ -248,12 +257,12 @@ func (conf *RecordConfig) API_list_recording_page(w http.ResponseWriter, r *http
|
||||
query := r.URL.Query()
|
||||
pageSize := query.Get("pageSize")
|
||||
pageNum := query.Get("pageNum")
|
||||
ID := query.Get("ID") //搜索条件
|
||||
RecId := query.Get("id") //搜索条件
|
||||
var outRecordings []any
|
||||
var totalPageCount int = 1
|
||||
if ID != "" {
|
||||
if RecId != "" {
|
||||
for _, record := range recordings {
|
||||
if strings.Contains(record.(IRecorder).GetRecorder().ID, ID) {
|
||||
if record.(IRecorder).GetRecorder().ID == RecId {
|
||||
outRecordings = append(outRecordings, record)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user