repochecker/videos: Improve checks when dealing with translated exercices

This commit is contained in:
nemunaire 2023-01-18 15:49:41 +01:00
commit a7309b6a00
2 changed files with 26 additions and 11 deletions

View file

@ -14,7 +14,7 @@ import (
"srs.epita.fr/fic-server/libfic"
)
func CheckGrammarSubtitleTrack(path string, exercice *fic.Exercice, exceptions *sync.CheckExceptions) (errs []error) {
func CheckGrammarSubtitleTrack(path string, index uint, exercice *fic.Exercice, exceptions *sync.CheckExceptions) (errs []error) {
tmpfile, err := ioutil.TempFile("", "resolution-*.srt")
if err != nil {
errs = append(errs, fmt.Errorf("unable to create a temporary file: %w", err))
@ -24,7 +24,7 @@ func CheckGrammarSubtitleTrack(path string, exercice *fic.Exercice, exceptions *
// Extract subtitles
err = ffmpeg.Input(path).
Output(tmpfile.Name(), ffmpeg.KwArgs{"map": "0:s:0"}).
Output(tmpfile.Name(), ffmpeg.KwArgs{"map": fmt.Sprintf("0:%d", index)}).
OverWriteOutput().Run()
if err != nil {
errs = append(errs, fmt.Errorf("ffmpeg returns an error when extracting subtitles track: %w", err))