Simon Kenyon wrote:
> Colin Guthrie wrote:
>>>The db schema is much neater (tho' the playlists is still a string list
>>of song_id's)
>> do you plan to change that?
> and if so, to what?
>> perhaps a table containing the playlist name and a single song id which
> you could iterate over
I did originally plan on changing it to a table defining the playlist
(auto-id + name) and a link table that contained (pl_id, song_id, order
{as db order cannot be guarenteed - especially for reordering etc.}).
However as I dug into the code I discovered a feature I didn't know
about which is that playlists can contain other playlists in them
(provided no circular dependancy is created overall).
In order to do this, they use negative numbers as song_ids in the
current database and the code is littered with "if (id < 1)" type
conditions. It's not very easy to understand but it does work.
Anyways, to represent this structure neatly in the database I'd need to
do a (pl_id, song_id, sub_pl_id, order) structure, where only one of
song_id or sub_pl_id can be specified and the other must be NULL (NULL
is better than 0 if you consider how foreign key constraints work, even
if we cannot use foreign keys with then MyISAM engine).
This wouldn't be too hard to do really but it was more code than I would
be able to do before larger redevelopments are done and I wanted to get
the other changes out of the way first and (hopefully) commited upstream.
Col.
--
+------------------------+
| Colin Guthrie |
+------------------------+
| myth(at)colin.guthr.ie |
|http://colin.guthr.ie/ |
+------------------------+