WiFi download of BlackVue capture files

Updated shell script to get all current days movies (and gps files) from BlackVue. The old script ran concurrent to capture and appeared to cause capture frame loss.

The idea is to run this about a minute after the last capture of the day. It will only transfer what had been recorded up to that point, not what is being recorded whilst the transfer is running. The transfer rate at 1-2m is roughly 6 MBytes/sec.

In this case a USB disk is mounted in the usual media location and called “MapDisk”

Be aware of the “current day” limitation if your device is running in UTC or over midnight.

export BVDATE=date +%Y%m%d
#export BVDATE=“20201030”
echo $BVDATE

cd /media/user/MapDisk
mkdir Record

# Write current list of todays files already saved to large drive
find ./Record -name "*.mp4" | cut -c 2-26 | grep $BVDATE | sort >filesondrive.txt

# Write current list of todays files on the BlackVue SDRAM
curl | sed 's/^n://' | sed 's/F.mp4//' | sed 's/R.mp4//' | sed 's/,s:1000000//' | sed $'s/\r//' | grep $BVDATE | sort >filesonblack.txt

# Compare file lists and output the next in line to be transferred
F2GS="`diff --suppress-common-lines -n filesondrive.txt filesonblack.txt| grep Record | grep -v 000000`"
echo $F2GS
cd Record

if [ "$F2GS" = "" ] ; then
	echo no-file-op
	for F2G in $F2GS; do
		# Grab mp4
		wget -cN$F2G.gps
		wget -cN$F2G\F.mp4

cd ..

The .gps files are more or less full nmea sentences with a text offset. To generate a full gpx file;

cat /media/user/MapDisk/Record/*.gps | uniq | cut -c 16- |grep GP| gpsbabel -i nmea -f - -o gpx,gpxver=1.0 -F output.gpx