repochecker: new option avoiding failure if resolution.mp4 missing
This commit is contained in:
parent
d458ac963a
commit
8b261011b6
2 changed files with 10 additions and 1 deletions
|
@ -2,6 +2,7 @@ package sync
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -13,6 +14,9 @@ import (
|
|||
"srs.epita.fr/fic-server/libfic"
|
||||
)
|
||||
|
||||
// LogMissingResolution logs the absence of resolution.mp4 instead of returning an error.
|
||||
var LogMissingResolution = false
|
||||
|
||||
func fixnbsp(s string) string {
|
||||
return strings.Replace(strings.Replace(strings.Replace(s, " ?", " ?", -1), " !", " !", -1), " :", " :", -1)
|
||||
}
|
||||
|
@ -189,7 +193,11 @@ func BuildExercice(i Importer, theme fic.Theme, epath string, dmap *map[int64]fi
|
|||
// Handle video
|
||||
e.VideoURI = path.Join(epath, "resolution.mp4")
|
||||
if !i.exists(e.VideoURI) {
|
||||
errs = append(errs, fmt.Sprintf("%q: resolution.mp4: no video file found at %s", edir, e.VideoURI))
|
||||
if LogMissingResolution {
|
||||
log.Printf("%q: resolution.mp4: no video file found at %s", edir, e.VideoURI)
|
||||
} else {
|
||||
errs = append(errs, fmt.Sprintf("%q: resolution.mp4: no video file found at %s", edir, e.VideoURI))
|
||||
}
|
||||
e.VideoURI = ""
|
||||
} else if size, err := getFileSize(i, e.VideoURI); err != nil {
|
||||
errs = append(errs, fmt.Sprintf("%q: resolution.mp4: ", edir, err))
|
||||
|
|
Reference in a new issue