Hello every one!
I'm pretty newbie, so plz be kind :)
I'm try to use my kobo touch 2.0 (a very old model) to display the timetable of the train station I have near my home.
To do so, it is sufficient to access the API of the local train system (which is viaggiatreno.it, since I live in Italy) and parsing the json file that is obtained. The results should be printed on screen.
Now, I'm like 95% from the end (hopefully), since I can see most of my results on the ereader; however, the main issue I am facing is to call the text I got in the piping in the shell with an angle of 90° (widescreen, rather than portrait).
My workflow so far is
- jail brake the Kobo with NickelMenù
- install KOReader.
- install FBInk
- run the following shell script:
`
#!/bin/sh
STAZIONE="S01513"
INTERVALLO=120
URL_BASE="http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/partenz>
FONT="/mnt/onboard/fonts/FreeMono.ttf"
FBSIZE=24
ROT=90
TMPFILE="/tmp/fbink.txt"
fbink -c
while true; do
DATA=$(date -u +"%a %b %d %Y %H:%M:%S GMT%z" | sed 's/ /%20/g')
wget -q -O - "${URL_BASE}/${STAZIONE}/${DATA}" |
tr '{},' '\n' |
grep -E '"categoria"|"numeroTreno"|"compOrarioPartenzaZeroEffettivo"|"destina>
sed 's/"//g' |
awk -F: -v ts="$(date '+%H:%M:%S')" '
BEGIN { printf "Aggiornato: %s\n\n", ts }
/categoria/ {cat=$2}
/numeroTreno/ {num=$2}
/compOrarioPartenzaZeroEffettivo/ {ora=$2}
/destinazione/ {dest=$2}
/ritardo/ {
rit=$2
gsub(/^ +| +$/,"",cat)
gsub(/^ +| +$/,"",num)
gsub(/^ +| +$/,"",ora)
gsub(/^ +| +$/,"",dest)
gsub(/^ +| +$/,"",rit)
printf "%-10s %-6s %-5s %-20s Rit:%2s min\n",
cat, num, ora, dest, rit
}
' | fbink -w >/dev/null 2>&1
#| fbink -f "$FONT" -s $FBSIZE -r $ROT >/dev/null 2>&1
sleep "$INTERVALLO"
done
`
thanks for your support!
Hello every one!
I'm pretty newbie, so plz be kind :)
I'm try to use my kobo touch 2.0 (a very old model) to display the timetable of the train station I have near my home.
To do so, it is sufficient to access the API of the local train system (which is viaggiatreno.it, since I live in Italy) and parsing the json file that is obtained. The results should be printed on screen.
Now, I'm like 95% from the end (hopefully), since I can see most of my results on the ereader; however, the main issue I am facing is to call the text I got in the piping in the shell with an angle of 90° (widescreen, rather than portrait).
My workflow so far is
`
#!/bin/sh
STAZIONE="S01513"
INTERVALLO=120
URL_BASE="http://www.viaggiatreno.it/infomobilita/resteasy/viaggiatreno/partenz>
FONT="/mnt/onboard/fonts/FreeMono.ttf"
FBSIZE=24
ROT=90
TMPFILE="/tmp/fbink.txt"
fbink -c
while true; do
DATA=$(date -u +"%a %b %d %Y %H:%M:%S GMT%z" | sed 's/ /%20/g')
wget -q -O - "${URL_BASE}/${STAZIONE}/${DATA}" |
tr '{},' '\n' |
grep -E '"categoria"|"numeroTreno"|"compOrarioPartenzaZeroEffettivo"|"destina>
sed 's/"//g' |
awk -F: -v ts="$(date '+%H:%M:%S')" '
BEGIN { printf "Aggiornato: %s\n\n", ts }
/categoria/ {cat=$2}
/numeroTreno/ {num=$2}
/compOrarioPartenzaZeroEffettivo/ {ora=$2}
/destinazione/ {dest=$2}
/ritardo/ {
rit=$2
gsub(/^ +| +$/,"",cat)
gsub(/^ +| +$/,"",num)
gsub(/^ +| +$/,"",ora)
gsub(/^ +| +$/,"",dest)
gsub(/^ +| +$/,"",rit)
printf "%-10s %-6s %-5s %-20s Rit:%2s min\n",
cat, num, ora, dest, rit
}
' | fbink -w >/dev/null 2>&1
#| fbink -f "$FONT" -s $FBSIZE -r $ROT >/dev/null 2>&1
sleep "$INTERVALLO"
done
`
thanks for your support!