>Great ideas, I will add them to the wishlist for SQLPlayList plugin.
>
Great!  If there's anything I can do to help...

>- When you say the the user should enter a parameter, do you mean in
>the web interface or are we talking about entering parameters using the
>remote ? or both ?
>
I was thinking mainly Player UI, as that is normally when I am thinking about 
playing random music, whereas I go to the web interface when I want to browse 
for something specific.

However, I guess it should really be both, otherwise the parameterised queries 
won't be available at all from the Web UI.  I haven't really thought about how 
the user interface would work with the Web UI though.  I don't think there's 
anything in slimserver or a plugin that does anything similar.

>- When you are talking about enumeration, it this just a special
>parameter type that mean that it should add all available id's of that
>object type in the query and never prompt the user ? 
>
>For example replacing:
>select tracks.url from tracks,playlist_track where
>tracks.id=track_playlist.track and track_playlist.playlist=({enumerate
>playlists}) order by random() limit 10;
>
I was thinking something along the lines of:

        --Param 1: playlist
        SET @playlist = ?
        SELECT tracks.url
        FROM tracks AS t JOIN track_playlist AS tp ON t.id = tp.track
        WHERE [EMAIL PROTECTED]
        ORDER BY random()
        LIMIT 10;

My SQL knowledge is mainly Microsoft SQL Server, so the syntax may be wrong.

The comment "param 1: playlist" could be interpretted by SQL Playlist plugin 
such that the plugin would know to prompt the user to select a valid playlist 
(ie. on the Player UI line 1 could read "Select a playlist..." and line 2 would 
be used to select a known static playlist using cursor keys).  If param 1 were 
defined as string (or the comment wasn't there - default string), then the user 
would enter a text string (like entering text in the Player UI search facility).

Perhaps an even better way would be to make the SQL files contain stored 
procedures.  I guess MySQL supports stored procedures, and that it is capable 
to dynamically determine the parameters that are expected for a stored 
procedure?  I guess performance may be better if stored procedures were used 
too.

So you would end up with something like:

        CREATE PROCEDURE RandomMusicFromPlaylist (@playlist as integer)
        AS
                SELECT tracks.url
                FROM tracks AS t JOIN track_playlist AS tp ON t.id = tp.track
                WHERE [EMAIL PROTECTED]
                ORDER BY random()
                LIMIT 10;
        GO

Nb, I am assuming that the id of the selected playlist would be obtained within 
slimserver, and the id passed into the stored procedure.

Phil
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/plugins

Reply via email to