repochecker/videos: Use subtitle track language as grammar check lang

This commit is contained in:
nemunaire 2023-01-18 19:25:27 +01:00
commit 1720906ec8
2 changed files with 6 additions and 4 deletions

View file

@ -148,11 +148,14 @@ func checkResolutionVideo(e *fic.Exercice, exceptions *sync.CheckExceptions) (er
errs = append(errs, fmt.Errorf("no subtitles track found"))
} else if len(subtitles_seen) > 0 {
for _, idx := range subtitles_seen {
language := e.Language
if lang, ok := vInfo.Streams[idx].Tags["language"]; e.Language != "" && (!ok || lang == "" || lang == "und") {
errs = append(errs, fmt.Errorf("subtitles track %d with no language defined", vInfo.Streams[idx].Index))
} else {
language = lang
}
errs = append(errs, CheckGrammarSubtitleTrack(path, vInfo.Streams[idx].Index, e, exceptions)...)
errs = append(errs, CheckGrammarSubtitleTrack(path, vInfo.Streams[idx].Index, language, exceptions)...)
}
if e.Language != "" && len(subtitles_seen) < 2 {