Wednesday 20 March 2019

Updating SQL Databases

I don't get at all excited about SQL databases, but they are very useful.  I have one for art which contains many details of pictures I have seen at various galleries.  In conjunction with the pictures I save descriptions of the paintings and have recently started adding my own comments on what is notable about them.
I use HeidiSQL to update the Maria/MySQL database but it is a bit of a nuisance for typing significant amounts of text.  I felt that a simple web front-end to the database would make updating details less onerous.  I didn't manage to find any utilities which would do this for me but I did find a couple of wonderful tutorials by Tania Rascia which explain how to carry out CRUD (create, read, update, delete) functions in PHP on database records.  The subject was so beautifully presented I was able to quickly complete and use the sample page.  Even better it was a simple matter to amend the basic structure to update my own database with a few minutes work.

Friday 15 March 2019

Alsa and Bluetooth Speakers

Normally it isn't possible to route linux sound output from ALSA directly through to Bluetooth speakers.  It is expected that output is routed via Pulseaudio.  This isn't terribly convenient for my music application which sends output from MPD to bluetooth, Pulseaudio is an extra inconvenience which needs to be managed.
Arkadiusz Bokowy has written a utility program bluez-alsa which allows you to define bluetooth speakers as ALSA devices obviating the need to use Pulseaudio.  MPD is set up with an ALSA output for the device.
Bluez-alsa needs to be compiled from source and full instructions are provided I found RPI specific instructions helped with this. I also needed to compile an FDK-AAC program  to get it to work.  However once completed the program works beautifully and I can finally treat bluetooth speakers as devices.

Monday 11 March 2019

Controlling Pure Jongos using upnpclient

I have previously written about a python script called nanodlna which is useful for "casting" ie sending dlna commands to Pure Jongo speakers and DACs.
A python script called upnpclient by Ellis Percival on Github does the job much more effectively.  It includes an excellent interactive explanation using upnpclient to explore and control a dlna device.  It provides device discovery storing upnp objects in python variables.  All device parameters are easily available so that device capabilities can be investigated (interactively) and controlled through python.
I developed a python program upnp.py which loaded URLs (SetAVTransportURI) and played / stopped the URI (Play and Stop functions). upnp devices need a streaming URL so a number of UK channels were coded into the script so they could be started.  Alternatively a URL can be entered on the command line to stream from an alternative source, for example the MuSe mpd server or an album / playlist M3U URL.
A web page JongoPanel was created to allow a user to see what is playing on each Jongo and start or stop the stream.  Any source can be directed to any or all Jongos.  JongoPanel calls upnp.py using the cgi interface.