Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: [PATCH] First shot of a seek function
From: Franšois-Xavier Houard (idefx_at_iname.com)
Date: 2002-09-02


Hi
I've worked in creating a fonction to search text entry in id3 and
filename.
there is no UI for the moment, just 2 function, Menu seek(void) and void seek_next(char *pattern, DIR dir) (seek is used to call seek_next)
so, seek may contain the input UI when it'll be ready (if someone
want's to make it, would be nice, i'm quite out of time for the
moment...), and seek_next take a string pattern, a dir handler, and look
for the next entry containing each token of the pattern, in album, title,
artist fields, or in filename. For the moment, the token delimitor is ' ',
but it is very easy to change, it will depend on what the input UI will
propose. The seek is case insensitive.
Just a few example to help:
seek_next("my",dir) will show the next entry in "dir", containing "my"
either in filename, title, artist, or album. next call to
seek_next("my",dir) will find the next entry corresponding (so, seek_next
change the dir argument).

a call to:
seek_next("my gate",dir) will find song including "my" and "gate" in one of a
field already told. So, it will find the song whose id3 is:
        Artist:""
        Song:"my gate is blue"
or
        Artist:""
        Song:"my favorite gate"
or
        Artist:"Jimmy whatever"
        Song:"gateau"
or
        Artist:"Bill Gates"
        Song:"My Way"
        
So, space char is considered as a delimitor, which can very easily been
change, if the input UI enable to use a special char as a delimitor, so,
this way, sarching for "my gate" will only get the first entry, wheras
searching for "my|gate" (where '|' is the delimitor) will get all the entry
found before.

The function works, except if it doesn't find any entry (segfault), but i
don't know how to detect end of the tree. And for the moment, there is no
input interface, and the function just show the filename, title, artist and
album. So, would be nice to create a "result" UI which will show filename,
and let people choose if they want to play the song, or search for the next
entry.

That's all. I attach the patch. The code is quite dirty, if anyone has some
suggestion to make about it (or wan't to code one of the 2 UI still
needed;), it would be nice ;)

Bye
Franšois-Xavier HOUARD
IdeFX_at_Iname.com





Page was last modified "Jan 10 2012" The Rockbox Crew
aaa