Giocoso Version 3 - Changelog

The Changelog will record code changes to the release version of Giocoso Version 3 as they are themselves released.

Changes are listed in reverse chronological order (i.e., the most recent releases appear first).

 

 

 


Giocoso Version 3.11 - Released October 20th 2024

This release brings three main enhancements:

  • Recall previous Advanced SQL
  • Auto-launch Mgiocoso Control Panel
  • Launch SqliteBrowser GUI and open the current Giocoso database directly from the Reports menu

In detail:

Recall Previous Advanced SQL: If you use the Play Music menu, Option 4 to type in complex SQL statements to select the music you want played, you may end up selecting dozens or even hundreds of possible play candidates. Having listened to a few of them, you may want the playback to cease: you'd therefore take the Control menu, Option 1 in a second Giocoso session (or an mgiocoso one) and make the playback of music stop after the currently-playing selection has completed. Fine: there's no change in functionality there, at all. The next day, however, you may want to continue with the same SQL selection as before, but can't remember precisely what SQL term you typed the previous day. Or maybe the SQL statement was exceedingly long and complex and you simply can't be bothered to re-type it!

The new feature in Giocoso Version 3.11 is that you can now tap the letter K when sitting on the Play Music menu and your previous complex SQL statement is immediately rekalled. The place where you'd previously have been asked to type a selection WHERE clause will then be automatically populated with your last Advanced SQL Selection: you can then edit that statement to make it slightly different from before, or just click [OK] and have the same SQL statement re-submitted as before.

Here it is in action. First, I make an advanced selection for a combination of the work of multiple composers:

Notice that the screen is asking you, in green, to 'Type a WHERE clause'. I then submit this query by selecting the OK button and pressing [Enter]:

Suppose after playing one or two of the selections thus made I decide I have had enough music for the day: I terminate playback. The next day, I tap the letter 'K' whilst sitting at the Play Music menu and see this:

It looks much the same as before, except that the screen now says 'Previously-used WHERE clause': the main body of the selection form has been automatically filled-in for me and I can just re-submit the same query as before or start typing additional clauses to modify it before submitting it.

It's a minor convenience at the end of the day, but you might find it useful. It works because every time you submit an advanced SQL query now, Giocoso stores it on disk. This means each new use of the old Play Music menu, Option 4 over-writes the previous advanced SQL. If I take option 4, type composer like '%bridge' and submit; then take option 4 again and type composer like '%mozart'; then tap the 'K' option... the selection form will display composer like '%mozart'. The earlier selection for music by Bridge is wiped by the later selection for music by Mozart. Putting it in different words, the K option can only recall the immediately previous advanced SQL selection.

So: if you want to make a new advanced SQL selection, use Play Menu, Option 4 and start typing. If you want to recall the immediately-prior advanced SQL selection, use Play Menu, tap K.

Note that the K option recalls the previous SQL, not the previous selection of recordings. For example, if your previous SQL selection had been 'everything by Vivaldi I haven't played before and which lasts less than 15 minutes', on Day 1 that might match 48 different recordings. You play 18 of them, then terminate playback. Next day, you use the K key to recall the previous SQL: you'll now match just 30 different recordings, because your SQL says 'play things which haven't been played before' but you played 18 of the prior candidates the previous day, so today they don't meet the 'not played before' search criterion. The SQL is recalled, therefore; but the results of applying that SQL selection might vary. Also, be aware that Giocoso always randomises the order of its selections -so even if the number of results don't change, the order in which the recordings it has selected are played will not match the previous days' efforts.

Auto-launch Mgiocoso Control Panel: Every time Giocoso is launched, it will automatically launch mgiocoso, the control panel for Giocoso proper, in a separate xterm window. The second window can be closed if you prefer: it's entirely independent of the main program. Closing the main program window will, however, automatically close the secondary mgiocoso window. This behaviour can be turned off by setting an appropriate value for the new 'Automatically launch Mgiocoso' configuration parameter (see Administration menu, Option 3). It's a yes/no parameter, so will appear on the third page of configuration options. The default value for the parameter has been set to be 'yes', but an explicit 'no' will take precedence.

Note that if the new mgiocoso window is allowed to launch, it survives only as long as the main Giocoso window does: if you quit Giocoso proper, or close its window by clicking its 'X' button in its title bar, or type Ctrl+C to terminate the program ...then the mgiocoso subsidiary window will automatically close too. You can, however, manually close the mgiocoso control panel independently, on its own, and that won't cause the main Giocoso window to be closed. If you've closed the mgiocoso window and wish to re-open it, just tap the letter 'M' from any of the main Giocoso window's menu options.

Launch SqliteBrowser GUI: On the Reports menu, a new option ('b' or 'B') will allow you to launch the sqlitebrowser GUI program to inspect the contents of your Giocoso database. For this to work, of course, the sqlitebrowser program needs to be installed on your system -but Giocoso doesn't demand that the program be installed at all for its own functionality. It's therefore up to you to install it at your leisure (something like sudo apt install sqlitebrowser will work on Debian- and Ubuntu-based distros; an equivalent sudo dnf install sqlitebrowser will do the trick on Fedora and so on). If the program is not independently installed by you, tapping the Reports menu 'B' key will do nothing. If it is installed, then the currently-selected Giocoso database will be opened in Sqlitebrowser for you. Please note that this option is potentially dangerous: the database is opened in full read-write mode and is thus capable of being modified by an accidental mouse-click! It's also the case that if you open the database whilst Giocoso is playing music, sqlitebrowser may conflict with Giocoso and thereby prevent Giocoso recording its plays properly. Only use this mode of viewing your database if you are comfortable poking around with powerful relational database tools, therefore.

Giocoso Version 3.10 - Released September 7th 2024

Giocoso has to be able to derive its 'play candidates' from two distinct sources: either a database containing details of which recordings exist and where; or from a simple, direct instruction to 'play the contents of this folder', without a database being involved. When a database is involved, the database stores details of the duration of the music within a folder: that duration can then be simply read and used when Giocoso has to display (for example) the countdown timer in the program's main header area (i.e., 'Played 00:05:43 of 00:07:21' ...the '7:21' total duration is simply read from the database). When a 'play the contents of this folder' instruction is received, however, as a result of taking the Play Music menu, Option 3, then no database can be read to deduce the music's duration and instead a summation of the lengths of each FLAC found within the specified folder is undertaken to determine a total duration for all music within the specified folder. Giocoso knows when to use one calculation method or the other depending on the value of a variable called DIRECT_PLAY: if it's '0', then durations are database-sourced; if it's '1', then durations are calculated and summed by inspecting the FLACs themselves.

Unfortunately, I recently noticed that the DIRECT_PLAY variable was not actually being set correctly. Only Option 3 of the Play Music menu should ever have set it to '1', but that was not the case: other play options (specifically, option 4, which is the one I was using when I noticed the problem) would incorrectly set it to 1, too. Practically, this may not have made a lot of difference: it would just mean that computation of the duration of plays would take place when no computation was needed (because the database already knew the right answer). Version 3.10 is thus a minor bug-fix to make sure the correct value for DIRECT_PLAY is set when appropriate menu options are taken.

In pursuing this slight bug, I noticed another, slightly more serious one: if your music folder names contain a double-quote (for example, Symphony No. 3 "Heroic"), that gets inserted into the database incorrectly (in the example, it would be inserted as Symphony No. 3 ##@##Heroic##@##). This prevents plays of that music from being recorded correctly (or for its duration to be computed/displayed correctly). Now fixed. Note that the incorrect folder names remain stored in the Giocoso database, even after the upgrade, until such time as you perform a fresh fast or full scan for music files (Database Management menu, Options 2 or 3). The next such database refresh will correctly update all affected folder names.

Giocoso Version 3.09 - Released August 29th 2024

For abstruse, technical and internal management reasons, a completed 'play' of a recording may end up being documented in the Giocoso database's PLAYS table twice, with a 1 second difference between the two rows of data. See this blog post for a detailed explanation of the problem.

This release creates a slightly modified version of the 'before insert on plays' trigger mentioned in that blog post to stop this doubling-up of plays taking place. A proposed play-completion will have one second taken off its proposed completion time; that modified completion time is compared to existing completion times already in the database. If the adjusted completion time, composer, composition and dirname (i.e., full path and file name) of the proposed play-completion matches that of a completed play already in the database, the insert is failed, silently. The second row of data that differs from an existing row by just one second thus never makes it into the database.

Please note that this patch does not go back to prior records and check whether any such 'out-by-one-second' duplicates exist: it only prevents future duplicates. You can do a manual check of whether or not such 'fake duplicate completions' exist by taking Giocoso's Reporting menu, Option 5 ("Advanced Reporting by SQL") and pasting the following query in:

with faulty_records as (select t1.id as orig_id, t1.playdate, t1.composer, t1.composition, t2.id as adj_id, datetime(t2.playdate,'-1 seconds'), t2.composer, t2.composition from plays t1 inner join plays t2 on t1.dirname=t2.DIRNAME and t1.playdate=datetime(t2.playdate,'-1 seconds') order by t1.playdate desc) select adj_id from faulty_records

If any rows are returned by that query, previous fake duplicates exist. The IDs returned by the query are those belonging to the fake 'play completion' inserts. You could then issue a 'delete from plays where id=xxxx' statements to remove the fake duplicates from the database. That can only be done by using a tool such as sqllitebrowser, however -and I'd only recommend bothering doing it if (a) you are comfortable with issuing SQL against a relational database and thus know what you're doing; and (b) if there is a large number of 'fake completion' records. I had 16 in a database recording 17,000+ plays: I wouldn't bother trying to delete those 16 records, given only 0.09% of recorded plays were affected.

Giocoso Version 3.08 - Released August 1st 2024

I can't quite decide if this release fixes a bug or adds an enhancement! The problem was that when Giocoso was playing music, it would display a cursor marker (indicated by the red arrow in the screenshot):

The 3.08 release now fixes that and no cursor marker is displayed:

Tiny, but necessary! (Entirely incidentally, it turns out I released this on 31st July 2024, but got the date wrong and it's marked as being an August 1st release. I'm not altering that now!)

Giocoso Version 3.07 - Released July 14th 2024

This release was necessitated by the realisation that ImageMagick (the program Giocoso uses to display and manipulate album art when music is played) comes in two versions. Version 6 uses a program called "convert", for which a command such as "convert -resize 450x450 image.jpg" would be valid. Version 7 puts up a warning message if the 'convert' command is used, saying that its use is deprecated. It also changes the syntax requirements so that the replacement program, "magick", now requires that the commands come in "image - task" order. Issue a command such as "magick -resize 450x450 image.jpg" therefore, and you'll get an error message saying that no image file called "450x450" could be found. Instead, you have to say, "magick image.jpg -resize 450x450": get the image mentioned first, then say what tasks you want applied to it.

The syntax variation means that you can't just alias convert => magick. You literally have to issue different commands, depending on which version of ImageMagick you're working with. Up until very recently, Version 6 was the one all the distros Giocoso was tested on used by default. The recent release of KDE Version 6, however, means that I noticed some distros are now shipping ImageMagick Version 7 by default.

This release therefore adds code to (1) identify which version of ImageMagick is installed; and (2) issues an appropriate convert or magick command (using different syntax ordering as needed) depending on what version is detected.

In Giocoso Version 3.06, if you were using the 'wrong' version of ImageMagick, the results would be very ugly indeed:

Error messages everywhere, completely scrambling the program display! Version 3.07 now works correctly in exactly the same environments.

Note that you don't have to worry about what version of ImageMagick is installed but it turns out that Giocoso has to ...and Version 3.07 is where it acquires the capacity to do so.

A tiny functional enhancement has additionally been made to mgiocoso3.sh, the mini-script that allows you to control a playing instance of Giocoso proper. A new menu option has been added: "N to make notes":

Tap the N key as music is playing and mgiocoso will open a new terminal editor, runnning the nano text editor, with a pre-populated date & timestamp, plus an indication of the piece of music currently playing. You can then just add any observations about the recording you like, press Ctrl+X to save the lot, and the terminal window will then close and return you to the mgiocoso menu pane.  For example:

Each new note is appended to any existing notes, again date-and-time-and-composer-composition stamped, and are all saved in the one file: $HOME/.local/share/giocoso3/txt/classical_music_notes.txt. Added as a quick way of making observations about the need to re-rip or otherwise process a recording whilst it's playing and without having to use different programs or different text files scattered across my file system to do so!

Giocoso Version 3.06 - Released May 1st 2024

This release includes fixes for two small bugs.

In the Play Music menu, there are various ways of getting Giocoso to initiate music playback: Option 1 does random selection; Option 2 allows you to fill in selection filters and then a random selection of music that matches those filters is made; Option 4 lets you type in a SQL statement to select matching music; Option 5 lets you play from a playlist and so on. The principle bug fixed in this release is that all options except number 1 set their own 'SELECTIONS' value. SELECTIONS is the number of pieces of music to play in one Giocoso session. If it's set to 5, for example, then Giocoso plays 5 random selections with a pause between each, then stops playing anything at all. There is a default SELECTIONS set in the Giocoso configuration file: this is read when you first launch Giocoso and sets the 'default' number of plays-per-session... until something changes it. As I've just mentioned, all play options except number 1 set their own value for the SELECTIONS, over-riding that set in the configuration file. This is usually fine: if you take Option 2 and say 'play Britten choral music that lasts less than 20 minutes', you may well get 56 matches: SELECTIONS will thus be set by that option to 56, and 56 recordings will be played in succession, no problems. The trouble starts if you interrupt that play sequence. Say, you've listened to 5 pieces of short Britten choral music and now you'd like a change of pace and scenery. You thus visit the Control menu and issue an 'Autostop' request. Eventually, playing of music in the main Giocoso session will stop, allowing you to take Option 1 to initiate a new series of completely random plays. Again, that will all work well and new music recordings will begin to play without drama. Except that there will be 56 such plays, not the number you might have expected given the setting in the configuration file.

Option 2's count of music plays has set SELECTIONS to 56. Option 1 did not re-read the configuration file to discover that the default number of plays-per-session was 10 (say). Option 1 thus picks up whatever value for SELECTIONS the other Play Music menu items may have set.

The bug-fix is that Play Music music Option 1 now does explcitly re-read the configuration file every time it is used and will thus re-apply the configured number of plays-per-cycle found there. Changes to that number that are triggered by taking any other Play Music menu option do not now therefore over-ride the setting in the configuration file.

A second minor bug-fix is that when parsing the configuration file, Giocoso was setting a variable called CYCLES, rather than one called SELECTIONS. It didn't really make any difference if you had a properly-constructed configuration file, though issues would have arrived if SELECTIONS were not set to anything at all in that file. The new bug fix now resolves the issue by consistently inspecting and setting the value for SELECTIONS and ignoring CYCLES, which was never actually used in Giocoso code after that point anyway.

Giocoso Version 3.05 - Released March 6th 2024

This release is triggered by the addition of a new feature.

Giocoso has always paused between separate 'plays' in a cycle of plays. That is, in the configuration file, you configure 'plays per cycle' (say, 10) and 'pause between plays in a cycle' (say, 5). That means Giocoso plays something, then waits 5 seconds, then plays something else, then pauses 5 seconds, then plays a third thing and so on, until the 10th recording has been played. The pause configured in this way is literally a halt to Giocoso doing anything, other than giving itself time to clear its memory buffers, write the details of the last play to its database, and so on. It also gave your ears a chance to rest between plays, so you didn't have Philip Glass immediately blasting your ears the moment some Vaughan Williams died away to nothingness in a sea of tranquility!

That 'pause between plays in a cycle' is still there and hasn't changed in functionality at all.

The problem with it, however, is that it means that though one piece of music has stopped playing, nothing at all is happening in Giocoso, so the next play in the cycle hasn't yet been selected, let alone started to be played. That's a problem if you are the kind of person that likes to follow along with a recording using a music score. Since you don't know what Giocoso is going to play next, because Giocoso itself hasn't made that selection yet, there is no way to grab the right score before the next selection is eventually made and almost immediately starts playing.

Version 3.05 thus introduces a new 'seconds to wait before playback starts' configuration parameter (at the bottom of this screenshot):

As configured here, it means Giocoso will pause 5 seconds after a play has completed, then it will make a new music selection and (the important new feature!) then it will wait another 20 seconds before commencing playback of the newly-selected recording. That means Giocoso has made a new music selection and knows its name and other details. It can therefore display those details in the main program, so that you can see what will be played, well before it actually starts playing:

At the bottom of the main program display, you'll see a line of text that contains a 'countdown' timer, indicating how many of the configured seconds of wait are left before play commences. In this way, I know that Casella's Paganiniana is going to be played -and prepare myself accordingly. In real life, 20 seconds is going to be too short a time for that to be useful, of course -but the new parameter can be set to any number of seconds from 0 upwards.

If you've set the original 'pause between plays' to 5 seconds and, as in this example, the new 'wait before playback' to 20 seconds, you'll now end up with 25 seconds of total pause between plays, 20 seconds of which you'll know what's due to play next.

The two 'pause' timers can happily co-exist, therefore. The new one defaults to 0 seconds, so unless you specifically go in to edit your configuration file (Administration menu Option 3), you won't experience it at all. Personally, I've left my 'pause between' set at 5 seconds, but have the new 'wait before' timer set to 200 seconds. That gives me nearly three minutes to grab the correct score and turn to the right page before playback starts, which I generally find adequate.

It can be argued that having two separate 'pause timers' is a bit redundant -and I don't disagree. This is definitely a development of functionality I hadn't realised the need for when I first wrote Giocoso, and thus the original 'pause between' timer seemed fine at the time, but is now seen to fail to convey useful information. The original 'pause between' may be deprecated in a future release as a result. For now, however, the two are independently configurable, do different things and co-exist perfectly well.

Giocoso Version 3.04 - Released on February 22nd 2024

A minor bug fix and the addition of a new remote control option.

The bug fix is to deal with how Giocoso responds to the case of a file of the right name appearing to be a music database, but internally the file isn't a database at all. Giocoso has always checked that, if you tell it in the configuration file to use a database called (say) 'my music', a file called "my music.db" exists in the $HOME/.local/share/giocoso3/db folder. If it didn't exist, then you'd get a nicely-formatted error telling you that the program is configured to use a database that doesn't exist, and to fix this situation before trying to play music again.

The trouble starts if you cd to $HOME/.local/share/giocoso3/db and manually issue the command touch "my music.db", for now you've created a file of the right name which isn't, internally, a database. Giocoso responded to this situation by believing it was using a proper database and attempting to query it for music to play. That would result in this:

The searches would error out, but not before making a mess of the display as it scrolls off the top of the terminal window. The bug fix is to handle that situation and instead display a nice, tidy error message:

In this situation, the 'not actually a database' condition is being triggered. The bug-fix is thus cosmetic in nature, primarily: you still end up with a Giocoso system that can't play any music, either way! It's just it now ends up in that state more 'attractively'!

The new feature added to the program is an entirely separate script called mgiocoso3.sh, which can be launched whilst another, standard Giocoso session is busy playing music. It will give you a cut-down view of the normal Giocoso Control menu:

From here, you can pause, resume, terminate or adjust the volume of what's playing in that other Giocoso session. The menu is 'cut-down' in the sense of being narrow: it's designed to be displayed on a mobile phone or other equivalent mobile device, allowing you to control a remote PC that's playing music via an ssh connection over wi-fi, for example.

Giocoso Version 3.03 - Released on January 23rd 2024

A single, relatively minor and cosmetic bug-fix in this release, related to pausing and resuming music playback (Control menu, Option 5). In earlier versions, the pause/resume toggle didn't actually check whether anything was playing before attempting to pause it (bizarrely, it did check that something was paused before attempting to resume it. Why I remembered to do the one and not the other... go figure and mea culpa!), with the result that attempting to pause music playback that didn't actually exist resulting in a slew of ugly-looking (but benign) operating system error messages, like this:

The error messages cause the main program display to scroll upwards and thus to scramble the intended display appearance. If you type 'a' and 'c' at this point, you trigger the re-display of the Administration and Control menus and thus get back to a semblance of normality -but it's messy and shouldn't happen.

The bug-fix in 3.03 is that a check is now made that playback is taking place before an attempt to pause it is made. Should it be the case that nothing is currently playing, the output in exactly the same situation as before now looks like this:

A discrete message briefly appears to tell you that you're trying to pause something when nothing is actually playing... but that message disappears after three seconds and the program is left otherwise as if no menu options at all had been taken.

Giocoso Version 3.02 - Released on January 11th 2024

Two small enhancements are introduced in this release. First, Giocoso now displays the number of times a recording has been played as it starts playing:

That 'Previous plays...' bit of text at the lower left of the screen will now display the count of all prior plays of the selected recording in cyan/light blue. The count is determined by performing a unique count of the folder name in which the recording physically resides, as stored in the PLAYS table. This does mean that if you were ever to rename a folder (say, change its name from "Symphhony No. 1" to the more correctly-spelled "Symphony No. 1") the recording will appear 'new' to Giocoso: previous plays will be recorded with the old, incorrect name, so when the newly-named folder is first played, there won't be matches for it in the PLAYS table and the previous play count will therefore be 0.

More significantly, the second enhancement kicks in whenever the 'Only play previously unplayed recordings' option in the Giocoso configuration file (accessible via the Administration Menu, Option 3) is switched on. That option now causes the initial random selection of a composer to play to filter out any composer who does not have any unplayed recordings attributed to him or her. Technically, the composer selection is now 'select distinct composer from recordings where dirname is not in (select dirname from PLAYS)'. Thus, all composers with previous plays are excluded from the sub-select, and thus only composers with at least one un-played recording become selectable at this point. Since the composer selection process thus only selects composers who have candidate un-played recordings available, the subsequent selection of an unplayed recording by that composer is guaranteed to produce a successful result. Some more detail is available in this blog piece.

The net effect is to make random selections of unplayed recordings much faster than before when the great majority of recordings in a collection have already been played: instead of literal minutes waiting for a random selection to just happen upon an unplayed recording, Giocoso is now guaranteed to select an unplayed recording first time of asking, within seconds.

Giocoso Version 3.01 - Released on December 29th 2023

A single, simple fix of a quite major bug. When playing multiple pieces of music from a playlist, Giocoso would add the new piece's duration to that already reached. If the playlist had instructions to play pieces that were (say) 5, 20, 13, 12 and 15 minutes long, the first piece would have been (correctly!) recorded in the Giocoso PLAYS table as having lasted for 5 minutes. The second piece, however, would have been recorded as having played for 25 minutes (i.e., the 5 minutes of the first piece plus the 20 minutes of the second piece actually played). The third piece would similarly have been recorded as having played for 38 minutes: 5+20+13, rather than just the actual duration of 13 minutes, and so on. In short, the program was storing the cumulative duration of the entire playlist as it progressed through it, rather than the duration of each piece found within the playlist.

See this blog piece for more details.

The bug fix in this version is simply to zero the duration variable as each new playlist item is reached. The variable thus only stores the duration of the piece actually being played, and only that value is then recorded in the PLAYS table, which is what should always have been happening.


[ User Manual Home ]