Add authors in themes
This commit is contained in:
parent
e628e7931c
commit
859dbc68cb
4 changed files with 24 additions and 17 deletions
|
@ -6,7 +6,8 @@ CLOUDPASS=fic:'f>t\nV33R|(+?$i*'
|
|||
|
||||
new_theme() {
|
||||
NAME=`echo $1 | sed 's/"/\\\\"/g'`
|
||||
curl -f -s -d "{\"name\": \"$NAME\"}" "${BASEURL}/api/themes/" |
|
||||
AUTHORS=`echo $2 | sed 's/"/\\\\"/g'`
|
||||
curl -f -s -d "{\"name\": \"$NAME\", \"authors\": \"$AUTHORS\"}" "${BASEURL}/api/themes/" |
|
||||
grep -Eo '"id":[0-9]+,' | grep -Eo "[0-9]+"
|
||||
}
|
||||
|
||||
|
@ -43,10 +44,12 @@ new_key() {
|
|||
}
|
||||
|
||||
# Theme
|
||||
curl -f -s -X PROPFIND -u "${CLOUDPASS}" "${BASEURI}" | xmllint --format - | grep 'd:href' | sed -E 's/^.*>(.*)<.*$/\1/' | sed 1d | while read f; do basename "$f"; done | while read THEME_URI
|
||||
curl -f -s -X PROPFIND -u "${CLOUDPASS}" "${BASEURI}" | xmllint --format - | grep 'd:href' | sed -E 's/^.*>(.*)<.*$/\1/' | sed 1d | tac | while read f; do basename "$f"; done | while read THEME_URI
|
||||
do
|
||||
THM_BASEURI="/${THEME_URI}/"
|
||||
THEME_NAME=$(echo "${THEME_URI}" | sed -E 's/%20/ /g' | sed -E 's/%c3%a9/é/g' | sed -E 's/%c3%a8/è/g')
|
||||
THEME_ID=`new_theme "$THEME_NAME"`
|
||||
THEME_AUTHORS=$(curl -f -s -u "${CLOUDPASS}" "${BASEURI}${THM_BASEURI}/AUTHORS.txt" | sed 's/$/,/' | xargs)
|
||||
THEME_ID=`new_theme "$THEME_NAME" "$THEME_AUTHORS"`
|
||||
if [ -z "$THEME_ID" ]; then
|
||||
echo -e "\e[31;01m!!! An error occured during theme add\e[00m"
|
||||
continue
|
||||
|
@ -56,7 +59,6 @@ do
|
|||
|
||||
LAST=null
|
||||
EXO_NUM=0
|
||||
THM_BASEURI="/${THEME_URI}/"
|
||||
curl -f -s -X PROPFIND -u "${CLOUDPASS}" "${BASEURI}${THM_BASEURI}" | xmllint --format - | grep 'd:href' | sed -E 's/^.*>(.*)<.*$/\1/' | sed -E 's/%20/ /g' | sed -E 's/%c3%a9/é/g' | sed -E 's/%c3%a8/è/g' | sed 1d | while read f; do basename "$f"; done | while read EXO_NAME
|
||||
do
|
||||
if ! echo $EXO_NAME | grep Exercice > /dev/null
|
||||
|
|
Reference in a new issue