Created
December 14, 2018 17:03
-
-
Save gurbain/3578d218a9b1f927b4c711b553026cf8 to your computer and use it in GitHub Desktop.
Donwload raw data from freestyle libre (android to linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
clear | |
_WORKDIR=/tmp | |
_NOW=$(date +%F_%H.%M) | |
_ADBOUT=/tmp/$_NOW | |
cd $_WORKDIR | |
echo "" | |
echo "Export des donnees.." | |
adb backup -f $_ADBOUT com.freestylelibre.app.be | |
if [ ! -e $_ADBOUT ] | |
then | |
echo "Export echoue, recommencez.." | |
exit 1 | |
fi | |
# traitements | |
tail -n +5 $_ADBOUT | zlib-flate -uncompress | tar -xv &> /dev/null | |
echo "" | |
echo "Creation des CSV..." | |
sqlite3 -header -csv -separator '|' /tmp/apps/com.freestylelibre.app.be/f/apollo.db "select Id,timestampUTC,comment from notes;" > librelink-comments_$_NOW.csv | |
sqlite3 -header -csv -separator '|' /tmp/apps/com.freestylelibre.app.be/f/sas.db "select readingId,timestampUTC,glucoseValue from historicReadings;" > librelink-glucosevalue_$_NOW.csv | |
#epoch2time | |
for i in comments glucosevalue | |
do | |
for epoch in $(cat librelink-${i}_${_NOW}.csv | awk -F\| '{ print $2 }') | |
do | |
_DATE=$(date -d@$((${epoch}/1000))) | |
sed -i "s/${epoch}/${_DATE}/g" librelink-${i}_${_NOW}.csv | |
done | |
done | |
echo "" | |
echo "Nettoyage.." | |
rm -f $_ADBOUT | |
mv /tmp/librelink-comments_$_NOW.csv ~/ | |
mv /tmp/librelink-glucosevalue_$_NOW.csv ~/ | |
echo "" | |
echo "Vos fichiers sont dans votre dossier personnel :" | |
echo "librelink-comments_$_NOW.csv (contiens vos notes)" | |
echo "librelink-glucosevalue_$_NOW.csv (contiens votre glycemie)" |
Hi @Thrajnor,
I'm sorry I don't have a clue. I copied and slightly adapted the script freely from this website https://www.surlemont.fr/dotclear/index.php?post/2017/02/18/Exporter-VOS-donn%C3%A9es-de-l-application-LibreLink to help the diffusion of this nice script but I haven't explored it further.
Good luck!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello there from Poland! :) what a great piece if code you have managed to make here. I'm looking for way to extract comment data from freestyle libre app to file, but i cant figure out a way to do it. Could you please help me with finding a way to do it, even with a little tutorial where and how exactly to use your bash code :)