We all have guilty pleasures and it seems that my girlfriends is 9gag (apart from chocolate, of course). So I went ahead and build a small tiny computer, which would let her watch her favourite content in something similar to a picture frame.
- Raspberry Pi 3
- a simple display
- 3D Printer for the case
The above setup is very simple to do and there are a lot of resources in the internet on how to combine these. I designed the case for the display myself and it’s actually very easy to do.
How does it work? You connect with the display via Telegram and send it 9gag links of gifs, or pictures/movies. These are stored on the sd card and randomly played back in a loop. The configuration should all go into config.json and you can see all options here. The application writes an example config the first time you start if, if no config exists.
For the software I wanted actually to experiment with Go, a new programming language the world is hyping about. My professional experience is with Java itself, so a compiled language (with at least some kind of garbage collection built in) makes sense for a small, powerless device. The resulting source code can be found here.
How was programming with Go? Well, this is a very difficult topic. Go seems to be a very hyped language and it has a few plus points (fast startup, small footprint) but many many problems in my opinion. Until you aren’t aware of go modules and how to use them, you can’t really program with go. Unfortunately the simple “Use go modules by creating go.mod” instruction is buried in a very deep documentation which takes hours to read.
I also had the application fail on me on the raspberry pi, while running perfectly on my pc. The simple reason: integers are platform dependent! In 2019! Please don’t get me even started on the error handling. The internet tells you it’s “awesome”, but it’s extremely annoying and error prone.
In the end everything has worked out and the app even works with Go. The girlfriend is happy and in the end it was a nice present.