by Robin at 20240501; fix upload fail video mod
This commit is contained in:
parent
e2501b7022
commit
aca9281087
|
@ -115,13 +115,21 @@ func handleVideoModeration(result *green20220302.VideoModerationResultResponseBo
|
||||||
audioResult := result.Data.AudioResult
|
audioResult := result.Data.AudioResult
|
||||||
|
|
||||||
// 解析信息
|
// 解析信息
|
||||||
frameSummaries, isFramesPassed := buildFrameSummaries(frameResult.FrameSummarys)
|
isFramesPassed := true
|
||||||
frameDetails := buildFrameDetails(frameResult.Frames)
|
isAudioPassed := true
|
||||||
audioSummaries, isAudioPassed := buildAudioSummaries(audioResult.AudioSummarys)
|
if frameResult != nil {
|
||||||
audioDetails := buildAudioDetails(result.Data.AudioResult.SliceDetails)
|
var frameSummaries []*dbstruct.FrameSummary
|
||||||
|
frameSummaries, isFramesPassed = buildFrameSummaries(frameResult.FrameSummarys)
|
||||||
videomoderation.FrameNum = frameResult.FrameNum
|
frameDetails := buildFrameDetails(frameResult.Frames)
|
||||||
videomoderation.SetFrameSummaries(frameSummaries).SetFrameDetails(frameDetails).SetAudioSummaries(audioSummaries).SetAudioDetails(audioDetails)
|
videomoderation.SetFrameSummaries(frameSummaries).SetFrameDetails(frameDetails)
|
||||||
|
videomoderation.FrameNum = frameResult.FrameNum
|
||||||
|
}
|
||||||
|
if audioResult != nil {
|
||||||
|
var audioSummaries []*dbstruct.AudioSummary
|
||||||
|
audioSummaries, isAudioPassed = buildAudioSummaries(audioResult.AudioSummarys)
|
||||||
|
audioDetails := buildAudioDetails(audioResult.SliceDetails)
|
||||||
|
videomoderation.SetAudioSummaries(audioSummaries).SetAudioDetails(audioDetails)
|
||||||
|
}
|
||||||
|
|
||||||
// 判定检测结果
|
// 判定检测结果
|
||||||
if isFramesPassed && isAudioPassed {
|
if isFramesPassed && isAudioPassed {
|
||||||
|
@ -165,12 +173,14 @@ func buildFrameSummaries(summaries []*green20220302.VideoModerationResultRespons
|
||||||
isPassed = true
|
isPassed = true
|
||||||
frameSummaries = make([]*dbstruct.FrameSummary, 0)
|
frameSummaries = make([]*dbstruct.FrameSummary, 0)
|
||||||
for _, summary := range summaries {
|
for _, summary := range summaries {
|
||||||
frameSummaries = append(frameSummaries, &dbstruct.FrameSummary{
|
if summary != nil {
|
||||||
Label: summary.Label,
|
frameSummaries = append(frameSummaries, &dbstruct.FrameSummary{
|
||||||
LabelSum: summary.LabelSum,
|
Label: summary.Label,
|
||||||
})
|
LabelSum: summary.LabelSum,
|
||||||
if util.DerefString(summary.Label) != VideoModerationPassLabel {
|
})
|
||||||
isPassed = false
|
if util.DerefString(summary.Label) != VideoModerationPassLabel {
|
||||||
|
isPassed = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -179,11 +189,13 @@ func buildFrameSummaries(summaries []*green20220302.VideoModerationResultRespons
|
||||||
func buildFrameDetails(details []*green20220302.VideoModerationResultResponseBodyDataFrameResultFrames) (frameDetails []*dbstruct.FrameDetail) {
|
func buildFrameDetails(details []*green20220302.VideoModerationResultResponseBodyDataFrameResultFrames) (frameDetails []*dbstruct.FrameDetail) {
|
||||||
frameDetails = make([]*dbstruct.FrameDetail, 0)
|
frameDetails = make([]*dbstruct.FrameDetail, 0)
|
||||||
for _, detail := range details {
|
for _, detail := range details {
|
||||||
frameDetail := &dbstruct.FrameDetail{
|
if detail != nil {
|
||||||
Offset: detail.Offset,
|
frameDetail := &dbstruct.FrameDetail{
|
||||||
|
Offset: detail.Offset,
|
||||||
|
}
|
||||||
|
frameDetail.SetFrameServiceDetails(buildFrameServiceDetails(detail.Results))
|
||||||
|
frameDetails = append(frameDetails, frameDetail)
|
||||||
}
|
}
|
||||||
frameDetail.SetFrameServiceDetails(buildFrameServiceDetails(detail.Results))
|
|
||||||
frameDetails = append(frameDetails, frameDetail)
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -191,11 +203,13 @@ func buildFrameDetails(details []*green20220302.VideoModerationResultResponseBod
|
||||||
func buildFrameServiceDetails(details []*green20220302.VideoModerationResultResponseBodyDataFrameResultFramesResults) (frameServiceDetails []*dbstruct.FrameServiceDetail) {
|
func buildFrameServiceDetails(details []*green20220302.VideoModerationResultResponseBodyDataFrameResultFramesResults) (frameServiceDetails []*dbstruct.FrameServiceDetail) {
|
||||||
frameServiceDetails = make([]*dbstruct.FrameServiceDetail, 0)
|
frameServiceDetails = make([]*dbstruct.FrameServiceDetail, 0)
|
||||||
for _, detail := range details {
|
for _, detail := range details {
|
||||||
frameServiceDetail := &dbstruct.FrameServiceDetail{
|
if detail != nil {
|
||||||
Service: detail.Service,
|
frameServiceDetail := &dbstruct.FrameServiceDetail{
|
||||||
|
Service: detail.Service,
|
||||||
|
}
|
||||||
|
frameServiceDetail.SetFrameLabelDetails(buildFrameLabelDetails(detail.Result))
|
||||||
|
frameServiceDetails = append(frameServiceDetails, frameServiceDetail)
|
||||||
}
|
}
|
||||||
frameServiceDetail.SetFrameLabelDetails(buildFrameLabelDetails(detail.Result))
|
|
||||||
frameServiceDetails = append(frameServiceDetails, frameServiceDetail)
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -203,10 +217,12 @@ func buildFrameServiceDetails(details []*green20220302.VideoModerationResultResp
|
||||||
func buildFrameLabelDetails(details []*green20220302.VideoModerationResultResponseBodyDataFrameResultFramesResultsResult) (frameLabelDetails []*dbstruct.FrameLabelDetail) {
|
func buildFrameLabelDetails(details []*green20220302.VideoModerationResultResponseBodyDataFrameResultFramesResultsResult) (frameLabelDetails []*dbstruct.FrameLabelDetail) {
|
||||||
frameLabelDetails = make([]*dbstruct.FrameLabelDetail, 0)
|
frameLabelDetails = make([]*dbstruct.FrameLabelDetail, 0)
|
||||||
for _, detail := range details {
|
for _, detail := range details {
|
||||||
frameLabelDetails = append(frameLabelDetails, &dbstruct.FrameLabelDetail{
|
if detail != nil {
|
||||||
Confidence: detail.Confidence,
|
frameLabelDetails = append(frameLabelDetails, &dbstruct.FrameLabelDetail{
|
||||||
Label: detail.Label,
|
Confidence: detail.Confidence,
|
||||||
})
|
Label: detail.Label,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -215,12 +231,14 @@ func buildAudioSummaries(summaries []*green20220302.VideoModerationResultRespons
|
||||||
isPassed = true
|
isPassed = true
|
||||||
audioSummaries = make([]*dbstruct.AudioSummary, 0)
|
audioSummaries = make([]*dbstruct.AudioSummary, 0)
|
||||||
for _, summary := range summaries {
|
for _, summary := range summaries {
|
||||||
audioSummaries = append(audioSummaries, &dbstruct.AudioSummary{
|
if summary != nil {
|
||||||
Label: summary.Label,
|
audioSummaries = append(audioSummaries, &dbstruct.AudioSummary{
|
||||||
LabelSum: summary.LabelSum,
|
Label: summary.Label,
|
||||||
})
|
LabelSum: summary.LabelSum,
|
||||||
if util.DerefString(summary.Label) != AudioModerationPassLabel {
|
})
|
||||||
isPassed = false
|
if util.DerefString(summary.Label) != AudioModerationPassLabel {
|
||||||
|
isPassed = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -229,18 +247,20 @@ func buildAudioSummaries(summaries []*green20220302.VideoModerationResultRespons
|
||||||
func buildAudioDetails(details []*green20220302.VideoModerationResultResponseBodyDataAudioResultSliceDetails) (audioDetails []*dbstruct.AudioDetail) {
|
func buildAudioDetails(details []*green20220302.VideoModerationResultResponseBodyDataAudioResultSliceDetails) (audioDetails []*dbstruct.AudioDetail) {
|
||||||
audioDetails = make([]*dbstruct.AudioDetail, 0)
|
audioDetails = make([]*dbstruct.AudioDetail, 0)
|
||||||
for _, detail := range details {
|
for _, detail := range details {
|
||||||
audioDetails = append(audioDetails, &dbstruct.AudioDetail{
|
if detail != nil {
|
||||||
EndTime: detail.EndTime,
|
audioDetails = append(audioDetails, &dbstruct.AudioDetail{
|
||||||
EndTimestamp: detail.EndTimestamp,
|
EndTime: detail.EndTime,
|
||||||
Extend: detail.Extend,
|
EndTimestamp: detail.EndTimestamp,
|
||||||
Labels: detail.Labels,
|
Extend: detail.Extend,
|
||||||
RiskTips: detail.RiskTips,
|
Labels: detail.Labels,
|
||||||
RiskWords: detail.RiskWords,
|
RiskTips: detail.RiskTips,
|
||||||
Score: detail.Score,
|
RiskWords: detail.RiskWords,
|
||||||
StartTime: detail.StartTime,
|
Score: detail.Score,
|
||||||
StartTimestamp: detail.StartTimestamp,
|
StartTime: detail.StartTime,
|
||||||
Text: detail.Text,
|
StartTimestamp: detail.StartTimestamp,
|
||||||
})
|
Text: detail.Text,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue