MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / extractFFmpegError

Function extractFFmpegError

agent/utils/convert/convert.go:162–185  ·  view source on GitHub ↗
(logStr string)

Source from the content-addressed store, hash-verified

160}
161
162func extractFFmpegError(logStr string) string {
163 priority := []string{"Error", "Invalid", "failed", "No "}
164 matches := make(map[string]string)
165 lines := strings.Split(strings.TrimSpace(logStr), "\n")
166 for i := 0; i < len(lines); i++ {
167 line := strings.TrimSpace(lines[i])
168 for _, kw := range priority {
169 if _, ok := matches[kw]; !ok && strings.Contains(line, kw) {
170 matches[kw] = line
171 }
172 }
173 }
174
175 for _, kw := range priority {
176 if line, ok := matches[kw]; ok {
177 return line
178 }
179 }
180
181 if len(lines) > 0 {
182 return lines[len(lines)-1]
183 }
184 return ""
185}

Callers 1

MediaFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected