Retro Future Electrics

A page about retro electronics, from the introduction of electricity until 1970-something. We refit old gadgets with new tech, and wonder at the makers who came before us.

Updating the Jukebox csv file

After getting the Wall-o-matic up and running, it quickly became apparent that actually filling it will 200 songs or playlists or other actions was going to take a long time. I did about 30 right away, and let it sit for months just using those. It took several minutes of tedious cutting and pasting to just add one item! A better way had to be at hand! Luckily Python is great at just about everything modern, including cgi scripts for a webpage. Previously I was using Numbers on the mac to create a .csv file (comma separated value, a de facto standard flat data file type. It’s just values separated by commas, each entry on a new line. Excel and Open Office and every spreadsheet program in the last 20 years can export and import them. ) It’s so common that python has a whole csv library built around handling them.

 

So I wrote two cgi python files that read and modify a line to a csv. They simply query the current Sonos system as to what it is playing, and then add it to the CSV with the title provided by the user. It’s quite a great improvement! Please note these should not be run on a public facing web server, no effort is made at security or checking that someone isn’t trying to do something nasty.

 

The files are posted on github Here

Leave a Comment

Your email address will not be published. Required fields are marked *