Category: Uncategorized

Setting up a raspberry pi photo viewer (with music)

I set up a Raspberry Pi photo viewer at work to display photos from members of the photo club.  Members were instructed to put their photos on a Google Drive location (accessible only within the company VPN) and then the viewer would sync down the photos at a predetermined schedule.  To get access to Google Drive, I used rclone.  To display I used ‘feh’, which was also used to put text indicating the name of the photo.

curl https://rclone.org/install.sh | sudo bash

rclone config

// choose google, team drive.  Follow the prompts

// To sync:
rclone sync -v motofoto:SoftwareKitchenPhotos /home/pi/Pictures/SoftwareKitchenPhotos/

// remember: that’s rclone sync -v <source> <destination>!  I have wiped out my local directory by syncing with an empty google drive folder!

// Setting up cronjob:
crontab -e

30 2 * * * /usr/bin/rclone sync motofoto:SoftwareKitchenPhotos /home/pi/Pictures/SoftwareKitchenPhotos/

// this runs the job at 2:30 every morning

Two scripts are set to launch on boot.  One plays music, the other starts feh.

The directory structure was such that from the root folder to be synced, photographers created a folder with their name and put their photos within it.  I requested that the photos have creative names.  Given this format, I could put a watermark on each photo in the bottom left by doing the following:

feh –recursive –slideshow-delay 10 –info “echo %F | rev | cut -d’/’ -f1-2 | rev | sed -r ‘s/[.].*//’ | sed -r ‘s/\// – /'”

I want to get the author name (lowest-level directory) and photo name (name of jpg file), strip off the jpg extension, and replace the directory separate “/” with a spaced hyphen ” – “.  To do this, I:

  • Get the path of the currently displayed photo “echo %F”.
  • To get the lowest level directory, I want to grab the directory and filename at the end.  I don’t know how many directories deep this will be, but if reversed, I know it will be the first and second elements (if “/” is considered as a separator: rev | cut -d’/’ -f1-2
  • I then want to reverse the result back, and strip off the .jpg from the filename (really, anything starting with “.”): rev | sed -r ‘s/[.].*//’
  • Finally, I want to replace the “/” with a hyphen, so it will be “Firstname Lastname – Name of photo”: sed -r ‘s/\// – /’

TODO: Starting photo viewer and music player on boot.

Install nodejs

Here is how I install nodejs to get access to cool tools like “tldr” (a summarized version of the typical man pages) and “ungit” (an interface to Git to ease people into using it).

Run these two commands to get nodejs:

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -

sudo apt-get install -y nodejs

then you can install ungit, tldr, whatever you want.

sudo npm install -g tldr

These commands work with Linux Mint 17 (or Ubuntu 14.04).

Tracks from a honeymoon

While over in Italy for our Honeymoon back in 2010, I used my trusty G1 for all our navigation.  Two years later, I finally got around to uploading the GPS tracks into Google Maps.  I had to use a trick to get the map into one page (typically, Google Maps tends to split the tracks over several pages, so you don’t see the whole view), but phew, I finally did it.

(Hit the ‘view larger map’ link below).


View Larger Map

Things to note:

  1. There is a straight line going from Venice to Bologna.  At this point, I switched off guidance and ‘did it live’.
  2. There are a few times I was literally going around in circles.  You’d have to zoom in to see it, but for example the Cinqueterre area has a few loops where we couldn’t figure out where the exit was (on the map, this is just a little to the South-East of Genoa).  I swear it was just crazy confusing.  I also did a lap or two around the hill our accommodation was on in Florence.
  3. The top speed I reached in our rental, a Fiat Punto, was 119 km/h.  That’s pretty tame by my morning commute standards, and I’m actually a bit disappointed that’s the fastest I drove in Italy… given it’s Italy (drivers seemed to be in some sort of race I didn’t know about).  The coolest thing about the driving over there  – only people going fast were in the fast lanes.  Florida – you suck at driving.

Photos from this trip are all here: http://www.flickr.com/photos/daecks/collections/72157624337372920/

Cover your ears

Ages and ages and yonks ago, we went on a drive up North to Georgia and South Carolina. On the way we stopped off in St Augustine and among other other things, saw Castillo de San Marcos, the oldest masonry fort in the US. They were firing a cannon, so I filmed a somewhat shaky video of it.

I procrastinated for ages in fixing up the shakiness, never bothering to fix it offline. Today Youtube came to my rescue by adding some new editing features. I used the powers of Youtube against the video and I’m pretty impressed with the results (I ain’t doing anything about the child-like glee at the end). I did notice a funky 3D-like parallax effect in areas where there was a lot of camera movement, but I think that also depended on the strength of the effect. Also, the higher the amount of shake reduction you want, the more cropping that will occur. Note that the brightness difference in the edited video below is intentional.

This youtubedoubler link shows the difference between the two videos more clearly.