Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xparse.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/parse.sh b/parse.sh
index 6a97478..079f4f0 100755
--- a/parse.sh
+++ b/parse.sh
@@ -88,7 +88,27 @@ do
else
if [ $ext == 'txt' ]
then
- grep -q 'Madagascar.activity' ../data && ext="madagascar"
+ cat ../data | json_verify -q
+ # A txt file might be written by the children, or an activity.
+ # The activity write the content following the JSON format.
+ if [ $? -eq 0 ]
+ then
+ ext='txt.act'
+ grep -q 'Madagascar.activity' ../data && ext="madagascar"
+ else # Handle special format
+ # No JSON but something containing [report/YYYY....
+ grep -q "^\[report/20" ../data && ext='txt.act'
+ # No JSON but always containing 1 number per line on 3 lines
+ grep -q "^\d*" ../data
+ if [ $? -eq 0 ]
+ then
+ w=`wc -lw ../data | awk '{print $1$2}'`
+ if [ $w -eq '33' ]
+ then
+ ext='txt.act'
+ fi
+ fi
+ fi
fi
cp -a ../data $out/datastore/$int.$ext