[mythtv] [PATCH] MythMusic smart playlist update

Paul mythtv at dsl.pipex.com
Tue Apr 5 17:34:37 UTC 2005

Add the two missing  field types (boolean and date) to the smart playlist
editor. Adds the compilation_artist (string), compilation (boolean),
lastplayed (date) and date_added (date) fields.

Adds a dialog to enter the date value. Allows for an explicit date or a
dynamic date that will be updated every time the smart playlist is run.
eg. '$DATE - 30 days' will be replaced with the current date minus 30 days.
Allows you to create playlists like "Tracks that have been imported in the
last 30 days" or "Tracks that haven't been played in over a year" for

Changes Metadata::dumpToDatabase(...) to update the date_added field when
a track is inserted into the database. The field is already there in the DB
we might as well use it :-)

The libmyth patch adds the MythRadioButton widget used by the
date dialog and also updates the MythListBox widget to change the
selected item color when it looses/gains focus to make it a little
easier to work out which widget has the current focus. Also changes
MythListBox to allow you to use LEFT/RIGHT arrow key presses
to move focus to previous/next widget. This fixes a problem in the
MythTV Select Phrase dialog among others where if you where
using a remote that doesn't have TAB bound to a key the focus could
get stuck on the ListBox with no way to move focus on to the other widgets.

Two questions for any MySQL experts out there.

1. What's the best way to extract the date part of a timestamp/datetime
field. From reading the docs I see that MySQL 4.1.1 now has a DATE( )
function to do it. But what is the best way to do it in earlier versions.
best I could come up with is FROM_DAYS(TO_DAYS(date_added)).
Just curious to know if that is the best way or not.

2. From reading the MySQL docs it would appear that using a timestamp for
the lastplayed field in the MythMusic DB would not be the best field type to
because it looks like timestamp fields always get updated to the current
date and time whenever an update takes place on a record unless the
field is explicitly changed in the update.
If I have understood the docs correctly that would mean that simply changing
the rating field, for example, would also change the lastplayed field. Is
this correct?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smartplaylist.tar.gz
Type: application/octet-stream
Size: 7814 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20050405/90bc3571/smartplaylist.tar.obj

More information about the mythtv-dev mailing list