diff --git a/admin/api/exercice.go b/admin/api/exercice.go index f0f55855..4b307798 100644 --- a/admin/api/exercice.go +++ b/admin/api/exercice.go @@ -258,7 +258,7 @@ func listTags(c *gin.Context) { } // Generate the csv to export with: -// curl -s http://127.0.0.1:8081/api/resolutions.json | jq -r ".[] | [ .theme,.title, @uri \"https://fic.srs.epita.fr/resolution/\\(.videoURI)\" ] | join(\";\")" +// curl -s http://127.0.0.1:8081/api/resolutions.json | jq -r ".[] | [ .theme,.level,.title, @uri \"https://fic.srs.epita.fr/$(date +%Y)/\\(.videoURI)\" ] | join(\";\")" func exportResolutionMovies(c *gin.Context) { exercices, err := fic.GetExercices() if err != nil { @@ -271,11 +271,13 @@ func exportResolutionMovies(c *gin.Context) { if theme, err := fic.GetTheme(exercice.IdTheme); err != nil { c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"errmsg": err.Error()}) return - } else { + } else if len(exercice.VideoURI) > 0 { + level, _ := exercice.GetLevel() export = append(export, map[string]string{ - "videoURI": exercice.VideoURI, + "videoURI": strings.Replace(exercice.VideoURI, "$FILES$/", "files/", 1), "theme": theme.Name, "title": exercice.Title, + "level": fmt.Sprintf("%d", level), }) } }