[mythtv] Re: [PATCH] MythMusic smart playlist update

Paul mythtv at dsl.pipex.com
Wed Apr 6 22:32:12 UTC 2005


Date: Wed, 6 Apr 2005 07:29:21 +0100
From: Stutty <stutty at gmail.com>

>Just on may way out the door, (been waiting for this patch for a
>while! - currently hacked my version to support a 'within' field i.e.
>within X days of lastplayed, etc.).

>Sorry can't answer your questions or give any feedback yet :(, but
>have a question of my own:

>Can you make it support empty playlists, I quiet often would like to
>create playlists before I have anything stored in them? For instance
>due to the date added issue, to start with there won't be anything in
>my 'Recently Added' playlist.

>I also sync the mythdatabase to my ipod, which may match songs where
>myth doesn't (okay mainly the date fields again).

>Thanks,

>will try the patch tonight,

>Paul

>On Apr 5, 2005 6:34 PM, Paul <mythtv at dsl.pipex.com> wrote:
>> 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
>> example.
>>
>> 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.
>> The
>> 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
>> use
>> 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
>> timestamp
>> 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?
>>
>>
>> Paul
>

Thanks for trying the patch. The attached revised patch does what you want.
Changed the behaviour to always allow you to save the smart playlist so long
as it is valid even if it doesn't return any results. Also fixed a small
issue where
the new date edit dialog didn't have an initial focus set to a widget.

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smartplaylist2.tar.gz
Type: application/octet-stream
Size: 8404 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20050406/52ddaae0/smartplaylist2.tar.obj


More information about the mythtv-dev mailing list