Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Raymond <shaiton@fedoraproject.org>2013-10-24 19:21:55 (GMT)
committer Kévin Raymond <shaiton@fedoraproject.org>2013-10-24 19:21:55 (GMT)
commitce1c82de0f8d749f2f7fdef267c1721cd1a434a0 (patch)
treef09cbee23849ad34f2a26c8bd0aaf434fcf69533
parent928af13ea3db8a5c57862f03b8cd1790aa086ccb (diff)
rename txt files that compiled from JSON activitiesHEADmaster
-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