Roy Schestowitz

XMMS History Logs


The principal idea has been explained once in the past, albeit at the time, only plain-text logs were generated. This page is intended to complement the previous item and describe a more complex method of generating meaningful tables or spreadsheets, which possess better log structure. For understanding of this method, the following two items ought to be read first:

When the latter of the two items can be easily comprehended, it is reasonable to step onto the next section of this page and make logs neater and generation more autonomous (cron jobs).

The Extension: Spreadsheet Output

Having read the items above for better understanding and general background, follow the stages below:

Setting up strings

  • Change the title format by going to Options » Preferences » top tab named Title. The string to enter, for the example in the remainder of this page, should be:

    %p, %t, %F, %y

    It means that a comma-separated list will be displayed and later on generated. It includes the artist (performer), the track name (title), the file (path included) and the year (if present).

  • Enter the command to be executed whenever a track has reached an end. To do so, navigate via Options » Preferences » top tab named Effect/General Plugins » Song Change » Configure (see image below). Enter the following string:

    date +', '%R' '%D; echo -n %s) >> ~/Music/playlist.log

    Do not forget the enable the plug-in by hitting the checkbox under the Effect/General Plugins tab. The above code will output the track title along with the corresponding date and time.

Cron Jobs

  • To make the data above meaningful in its context, table heads (column names) must be added. Create a file named playlist_head under ~/Music (keeping consistency of directories for this basic example). The file should be a simple ASCII text-only object containing the following line:

    Artist/Performer, Track Title, File and full path,
    Year of track, Track switch time and date

    Note that the above should be a single line of comma-separated values.

  • Download the file save_playlist.sh to your hard-drive and set it to be executed nightly using your crontab. It essentially makes this task (script) a cron job. For example, add the following to your list of cron jobs:

    59 23 * * * /home/YOUR_USER_NAME/Music/save_playlist.sh

    YOUR_USER_NAME (e.g. john) will be necessary in order for the root-driven cron to be directed to the right path. It is otherwise ambiguous. This will separate your logs just before midnight so that you obtain a collection of daily, well-stamped logs rather than one huge log file.

Data Management

As time goes on, more and more .csv files will accumulate on your hard-drive. They can be opened using KSpread or any other spreadsheet management tool, e.g. MATLAB, Open Office, Office/Excel and so forth. Below is a visual example from KSpread which is a light tool that handles the light and simple datatype which has been generated.

Music Logs
Spreadsheet representation of music history (click to enlarge)

Final Words

If you like the ideas expressed in this page, you may also like the Google cron page. The power of automation makes extraction of (huge amounts of data) painless and therefore, it is usually worth exploiting. Time might bring extensions to mind while technological advancement might will your data to some use, even if that use cannot be realised yet.

This page was last modified on July 22nd, 2005 Maintained by Roy Schestowitz