repochecker: new option avoiding failure if resolution.mp4 missing
This commit is contained in:
parent
d458ac963a
commit
8b261011b6
|
@ -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))
|
||||
|
|
|
@ -76,6 +76,7 @@ func main() {
|
|||
flag.BoolVar(&fic.OptionalDigest, "optionaldigest", fic.OptionalDigest, "Is the digest required when importing files?")
|
||||
flag.BoolVar(&fic.StrongDigest, "strongdigest", fic.StrongDigest, "Are BLAKE2b digests required or is SHA-1 good enough?")
|
||||
flag.BoolVar(&skipFileChecks, "skipfiledigests", skipFileChecks, "Don't perform DIGESTS checks on file to speed up the checks")
|
||||
flag.BoolVar(&sync.LogMissingResolution, "skipresolution", sync.LogMissingResolution, "Don't fail if resolution.mp4 is absent")
|
||||
flag.Parse()
|
||||
|
||||
log.SetPrefix("[repochecker] ")
|
||||
|
|
Loading…
Reference in New Issue