After pondering the searching issue some more, I came up with a function
prototype that will (hopefully) address everyone's needs:
int FindSong(char *pattern, int type, int casematters)

Pattern is just the search pattern, type is what type of search to
perform, and casematters indicates whether the search is
case-sensitive. The types would work like this:
Type 0 is a simple search. If the pattern occurs anywhere in the track
name, it's a match.
Type 1 is a wildcard search. The pattern must match the _entire_ track
name, * matches anything (including nothing), and ? matches one
character. \ makes the next character have its literal meaning.
Type 2 would be a regex search. Anything goes.

This could be done easily using the regex routines which are part of
libc. Additionally, regex.c (from the sed package) could be included to
link against for platforms that lack built-in regex support.

Does this address everyone's searching desires?


Also, after seeing the various searching suggestions that were posted
(especially the one about returning search results as a playlist), it
struck me that there are two fundamentally different types of searching
support. The first is a very flexible, powerful search that could look at
any (or all) of the metadata fields in the MusicCatalog and create a
playlist based on the results. This is great for graphical players, which
have a need for on-the-fly playlist modification and the ability to
import/export from the catalog. However, it is nearly useless for
text-based players which have a fixed playlist and no good way to
import/export from a db. The other method is a fast-and-dirty search that
would be quick and easy to use and only check a specific attribute of the
song. (eg., the pathname) This method would only return one result, but it
could be used multiple times to access different songs that matched the
pattern. This is very useful for the text-based players, which lack any
method of jumping to a given song in the playlist, but it is virtually
useless for graphical players, where the user can simply click on a song
to play it. I believe that most people want the first kind of searching
support, because most people like their GUIs. For backwards people like me
who still live in the stone age, the latter type is an absolute
necessity. Does this sound reasonable?

-- 
=D ave

_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev

Reply via email to