KISS – Keep It Simple Stupid. Yup, just revisited that one again.
I recently purchased a HDHomeRun network TV tuner from Silicon Dust and after trying numerous TV media applications; MS-Windows and Linux, I decided to write my own.
All I wanted was the ability to record a program on a channel at a particular time. And as I wanted to run this on an old laptop, I did not want the overheads from a full-featured TV Media streaming application.
So, I started with Python to massage the command line info (start time, end time, channel, tuner, etc.) into a series of commands to the supplied configuration application from Silicon Dust. After some success, I rewrote the Python application to use the library routines (also supplied) rather than executing a sub-process from within Python.
This is where it all got rather contrived. The library is written in c (c+ actually) and there are a number of variable array’s which have to be interfaced into Python via the ctypes module. This can get rather tricky. After a couple of days, I decided to re-think the whole development.
Shell scripting or programming!
As I was going to always use Linux, and all I was really doing was swapping around command-line options to several other applications and I needed the resultant code to be light, a shell script did seem to fit the bill.
So, in half a day I had a working application and by the next day, I had background tasking and scheduling working. It has been a good exercise, as it has been quite some time since I have developed a decent lengthy and complex shell script. And substituting and quoting it no easier on the revisited learning curve.
So, there you go: When in a corner, rethink the problem and Keep It Simple Stupid…