0.1.4
This commit is contained in:
38
bash_scripts/generate.sh
Executable file
38
bash_scripts/generate.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
# relative or absolute path where the classes are
|
||||
path=../public/data/class/*
|
||||
|
||||
# image filetype needs to be the same
|
||||
file_type=*.jpg
|
||||
|
||||
# REGEX
|
||||
reg='(.*)class\/([0\-9A\-z_]*)\/([0\-9A\-z_]*)\.jpg'
|
||||
#reg='class\/([0\-9A\-z_]*)'
|
||||
for i in $path
|
||||
do
|
||||
if [ -d "$i" ]; then
|
||||
#echo "$i"
|
||||
|
||||
json_file=$i/user.json
|
||||
|
||||
printf '{\n"user":[\n'>$json_file
|
||||
|
||||
for j in $i/*
|
||||
do
|
||||
|
||||
if [[ $j == ${file_type} ]]; then
|
||||
if [[ $j =~ ${reg} ]]; then
|
||||
echo "${BASH_REMATCH[3]}"
|
||||
printf '"'>>$json_file
|
||||
printf ${BASH_REMATCH[3]}>>$json_file
|
||||
printf '",\n'>>$json_file
|
||||
else
|
||||
echo "TEST2"
|
||||
echo $j
|
||||
fi
|
||||
fi
|
||||
done
|
||||
cat $json_file | rev | cut -c 3- | rev
|
||||
|
||||
fi
|
||||
done
|
||||
0
bash_scripts/regenerate.sh
Normal file
0
bash_scripts/regenerate.sh
Normal file
Reference in New Issue
Block a user